473,574 Members | 3,182 Online
Bytes | Software Development & Data Engineering Community
+ 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(By Val 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 1349
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(By Val 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(By Val 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.XMLHttp Request) {
req = new XMLHttpRequest( );
} else if (window.ActiveX Object) {
isIE = true;
req = new ActiveXObject(" Microsoft.XMLHT TP");
}
req.open("GET", "server.asp x", 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(By Val 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.XMLHttp Request) {
req = new XMLHttpRequest( );
} else if (window.ActiveX Object) {
isIE = true;
req = new ActiveXObject(" Microsoft.XMLHT TP");
}
req.open("GET", "server.asp x", 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.comwro te:
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(By Val 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.XMLHttp Request) {
req = new XMLHttpRequest( );
} else if (window.ActiveX Object) {
isIE = true;
req = new ActiveXObject(" Microsoft.XMLHT TP");
}
req.open("GET", "server.asp x", 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?st artMethod=SomeC allback", 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
3411
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 Pentagjetvedeh karuvificials madhla reachathe strategy in karkun campaign deshatinst terrorism. "mudivae maretu winning or losing karkun global...
10
4421
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 1.5 and here is the code that is being called: function showConsumptionData(foodType) { var url =
10
4398
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 that, I installed the "November 2006 CTP" and "Control Toolkit" - then I re-booted my machine. Next I tried to create a simple, sample page... I...
4
8729
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 filter a list from a database and populate some filtered options for the user to choose in a seperate listbox. Any subsequent key presses will further...
1
2025
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 I cannot figure out how I am getting it. I am trying to program a specific event calendar, the issue is on one of the events. I am trying to allow...
1
2007
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 the contents from a server side script as AJAX generally does and process it using that function. This far Im quite pleased with it, however, I...
6
1602
by: Scott M. | last post by:
What is the version number of AJAX when we talk about ASP .NET AJAX in VS 2008?
2
1854
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 considering offering Web pages both to browsers that support AJAX and to those that do not support AJAX. Questions: 1. In general, should I look...
0
7764
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8111
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5660
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5336
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3776
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2282
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 we have to send another system
1
1375
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1102
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.