473,465 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Need Ajax Help: Targeting Specific Methods

Hi.

I have an ajax question.
I am wondering if it is possible to get the response from a method
within a given page, and that function alone? Traditionally, I have
been getting the response from the Page_Load method of the targeted
page, but now I want the response from a particular method on the
target page:

Public Sub SomeCallback(ByVal sender As Object, ByVal e As EventArgs)

'RETURN XML FOR CALLBACK

End Sub

Could somebody tell me how to focus on the resonse of a given method
inside a page? Thanks.

Mar 12 '07 #1
4 1339
On Mar 12, 9:55 am, "pbd22" <dush...@gmail.comwrote:
Hi.

I have an ajax question.
I am wondering if it is possible to get the response from a method
within a given page, and that function alone? Traditionally, I have
been getting the response from the Page_Load method of the targeted
page, but now I want the response from a particular method on the
target page:

Public Sub SomeCallback(ByVal sender As Object, ByVal e As EventArgs)

'RETURN XML FOR CALLBACK

End Sub

Could somebody tell me how to focus on the resonse of a given method
inside a page? Thanks.
Events are fired by DOM elements (e.g. load event when the document
has finished loading), javscript functions don't have any such
concept.

If you want something to happen when a function is called, either have
the function call the method or wrap the function in some other method
and call your "event" function straight after the one you want to
watch.
--
Rob

Mar 12 '07 #2
On Mar 11, 9:13 pm, "RobG" <r...@iinet.net.auwrote:
On Mar 12, 9:55 am, "pbd22" <dush...@gmail.comwrote:
Hi.
I have an ajax question.
I am wondering if it is possible to get the response from a method
within a given page, and that function alone? Traditionally, I have
been getting the response from the Page_Load method of the targeted
page, but now I want the response from a particular method on the
target page:
Public Sub SomeCallback(ByVal sender As Object, ByVal e As EventArgs)
'RETURN XML FOR CALLBACK
End Sub
Could somebody tell me how to focus on the resonse of a given method
inside a page? Thanks.

Events are fired by DOM elements (e.g. load event when the document
has finished loading), javscript functions don't have any such
concept.

If you want something to happen when a function is called, either have
the function call the method or wrap the function in some other method
and call your "event" function straight after the one you want to
watch.

--
Rob

Thanks.

Maybe I misunderstand what you are saying, but, I still don't
understand how to call a server method from the client-side
ajax call. would you mind showing me how to solve this problem? For
example, for the below ajax call, I am getting the response from the
Server.aspx pages's Page_Load method. But, how would I design the
below function to get the response from the server's SomeCallback
method?

function startRequest() {
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
isIE = true;
req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.open("GET", "server.aspx", true);
}

Mar 12 '07 #3
On Mar 12, 5:18 pm, "pbd22" <dush...@gmail.comwrote:
On Mar 11, 9:13 pm, "RobG" <r...@iinet.net.auwrote:
On Mar 12, 9:55 am, "pbd22" <dush...@gmail.comwrote:
Hi.
I have an ajax question.
I am wondering if it is possible to get the response from a method
within a given page, and that function alone? Traditionally, I have
been getting the response from the Page_Load method of the targeted
page, but now I want the response from a particular method on the
target page:
Public Sub SomeCallback(ByVal sender As Object, ByVal e As EventArgs)
'RETURN XML FOR CALLBACK
End Sub
Could somebody tell me how to focus on the resonse of a given method
inside a page? Thanks.
Events are fired by DOM elements (e.g. load event when the document
has finished loading), javscript functions don't have any such
concept.
If you want something to happen when a function is called, either have
the function call the method or wrap the function in some other method
and call your "event" function straight after the one you want to
watch.
--
Rob

Thanks.

Maybe I misunderstand what you are saying, but, I still don't
understand how to call a server method from the client-side
ajax call. would you mind showing me how to solve this problem? For
example, for the below ajax call, I am getting the response from the
Server.aspx pages's Page_Load method. But, how would I design the
below function to get the response from the server's SomeCallback
method?

function startRequest() {
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
isIE = true;
req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.open("GET", "server.aspx", true);

}
Provide the script with a url parameter inside your ajax request, and
the script should call the proper method depending on this parameter.
You can't interfere with the work of your server script from inside
JavaScript. To ajax, i.e. to http protocol, all you're requesting is
the result of a program. What that program does is irrelevant for it,
as long as it gets the proper result. However, you can provide it with
parameters based upon which the server script can decide what methods
it's going to call.

Mar 12 '07 #4
On Mar 12, 10:36 am, "Darko" <darko.maksimo...@gmail.comwrote:
On Mar 12, 5:18 pm, "pbd22" <dush...@gmail.comwrote:
On Mar 11, 9:13 pm, "RobG" <r...@iinet.net.auwrote:
On Mar 12, 9:55 am, "pbd22" <dush...@gmail.comwrote:
Hi.
I have an ajax question.
I am wondering if it is possible to get the response from a method
within a given page, and that function alone? Traditionally, I have
been getting the response from the Page_Load method of the targeted
page, but now I want the response from a particular method on the
target page:
Public Sub SomeCallback(ByVal sender As Object, ByVal e As EventArgs)
'RETURN XML FOR CALLBACK
End Sub
Could somebody tell me how to focus on the resonse of a given method
inside a page? Thanks.
Events are fired by DOM elements (e.g. load event when the document
has finished loading), javscript functions don't have any such
concept.
If you want something to happen when a function is called, either have
the function call the method or wrap the function in some other method
and call your "event" function straight after the one you want to
watch.
--
Rob
Thanks.
Maybe I misunderstand what you are saying, but, I still don't
understand how to call a server method from the client-side
ajax call. would you mind showing me how to solve this problem? For
example, for the below ajax call, I am getting the response from the
Server.aspx pages's Page_Load method. But, how would I design the
below function to get the response from the server's SomeCallback
method?
function startRequest() {
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
isIE = true;
req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.open("GET", "server.aspx", true);
}

Provide the script with a url parameter inside your ajax request, and
the script should call the proper method depending on this parameter.
You can't interfere with the work of your server script from inside
JavaScript. To ajax, i.e. to http protocol, all you're requesting is
the result of a program. What that program does is irrelevant for it,
as long as it gets the proper result. However, you can provide it with
parameters based upon which the server script can decide what methods
it's going to call.

Thanks Darko (and Rob),

I think I understand. Not sure tho.

So, are you saying that if I include a parameter in the xmlhttp
request that points to the server-side method I will be able to target
that method's response? For example:

req.open("GET", "server.aspx?startMethod=SomeCallback", true);

This doesn't look right. Would somebody mind showing me a code example
of how to do this (your own code or a link)? Sorry, I just want to
make sure I understand this.

Thanks.

Mar 13 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed...
10
by: sheadley | last post by:
Hi all, When using AJAX and javascript I get the following error when talking to my server: A script from http://www.mydomain.com was denied UniversalBrowserRead privileges. I am using firefox...
10
by: celoftis | last post by:
Using VS 2005: This morning, following the instructions here: http://ajax.asp.net/docs/overview/InstallingASPNETAJAX.aspx, I installed ASP.NET AJAX on my WinXP Pro development machine. Following...
4
by: Grant Merwitz | last post by:
Hi I am trying to implement the Microsoft Ajax.NET extensions to perform a lookup on a key press of a text box. What this will do is once a user enters a letter into the textbox, this will...
1
by: jborg | last post by:
I have a method to send PHP array values via Ajax to another PHP file that processes my request, however I cannot get it to work here. I know this is normally a basic and very general error, but...
1
by: bizt | last post by:
Hi, I am having my first real attempt at an ajax class as so far Ive managed to build one that, once instatiated, will allow me to define which function it will call on completion then retrieves...
6
by: Scott M. | last post by:
What is the version number of AJAX when we talk about ASP .NET AJAX in VS 2008?
2
by: Johnson | last post by:
While I have done a substantial amount of ASP.NET programming, I have only dabbled with AJAX (update panels and a 3rd party JSON setup - jayrock - that directly updates the DOM). In any case, I'm...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.