472,804 Members | 810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,804 software developers and data experts.

Passing multiple arguments to the client-side JavaScript function in AJAX

I am a beginner with AJAX, and have managed to learn how to use it when
passing single parameters, but I want to return more than one value to the
client-side JavaScript function that displays it. My client-side JavaScript
function takes 4 parameters (which are expected to be integers). The idea of
passing a single parameter and parsing it on the client has occurred to me,
but since I am sure I am not the only person who has situations that require
more than one parameter, I was hoping there would be an easier way. Any
ideas? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 20 '06 #1
4 3761
Hi,

Nathan Sokalski wrote:
I am a beginner with AJAX, and have managed to learn how to use it when
passing single parameters, but I want to return more than one value to the
client-side JavaScript function that displays it. My client-side JavaScript
function takes 4 parameters (which are expected to be integers). The idea of
passing a single parameter and parsing it on the client has occurred to me,
but since I am sure I am not the only person who has situations that require
more than one parameter, I was hoping there would be an easier way. Any
ideas? Thanks.
AJAX doesn't mean much. Do you use SOAP, or a simple ASHX custom
handler, or something else?

With SOAP, you can pass an object back to the JavaScript client. Note
that unless you use a library doing that for you (for example ASP.NET
AJAX formerly known as ATLAS), you must parse the result yourself.

If you use a custom handler, you can return XML in the response, and
then parse the received XML. Nothing prevents you then to define your
own XML format to pass any number of parameters to the script.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Nov 20 '06 #2
Sorry, I probably should have included more details. I am writing a custom
control for ASP.NET using VB.NET and want to include AJAX. I am using the
following for the AJAX:

I am using the ICallbackEventHandler interface by including the following
line:
Implements ICallbackEventHandler

This interface includes implementing the following method and function:
Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements
ICallbackEventHandler.RaiseCallbackEvent
Public Function GetCallbackResult() As String Implements
ICallbackEventHandler.GetCallbackResult
Because ATLAS is still in Beta (at least the last time I checked), I did not
want to start using it yet. If I understand you correct, there is no simple
way to pass multiple parameters using only VB.NET and JavaScript? Thank you
for the information.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,

Nathan Sokalski wrote:
>I am a beginner with AJAX, and have managed to learn how to use it when
passing single parameters, but I want to return more than one value to
the client-side JavaScript function that displays it. My client-side
JavaScript function takes 4 parameters (which are expected to be
integers). The idea of passing a single parameter and parsing it on the
client has occurred to me, but since I am sure I am not the only person
who has situations that require more than one parameter, I was hoping
there would be an easier way. Any ideas? Thanks.

AJAX doesn't mean much. Do you use SOAP, or a simple ASHX custom handler,
or something else?

With SOAP, you can pass an object back to the JavaScript client. Note that
unless you use a library doing that for you (for example ASP.NET AJAX
formerly known as ATLAS), you must parse the result yourself.

If you use a custom handler, you can return XML in the response, and then
parse the received XML. Nothing prevents you then to define your own XML
format to pass any number of parameters to the script.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

Nov 20 '06 #3
Hi,

with Ajax.NET Professional (http://www.ajaxpro.info/) you can use multiple
parameters to call .NET methods. As return value you can use any type, i.e.
DataTable or arrays or your own structures/classes.

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/


"Nathan Sokalski" <nj********@hotmail.comschrieb im Newsbeitrag
news:Oj**************@TK2MSFTNGP02.phx.gbl...
Sorry, I probably should have included more details. I am writing a custom
control for ASP.NET using VB.NET and want to include AJAX. I am using the
following for the AJAX:

I am using the ICallbackEventHandler interface by including the following
line:
Implements ICallbackEventHandler

This interface includes implementing the following method and function:
Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements
ICallbackEventHandler.RaiseCallbackEvent
Public Function GetCallbackResult() As String Implements
ICallbackEventHandler.GetCallbackResult
Because ATLAS is still in Beta (at least the last time I checked), I did
not want to start using it yet. If I understand you correct, there is no
simple way to pass multiple parameters using only VB.NET and JavaScript?
Thank you for the information.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>Hi,

Nathan Sokalski wrote:
>>I am a beginner with AJAX, and have managed to learn how to use it when
passing single parameters, but I want to return more than one value to
the client-side JavaScript function that displays it. My client-side
JavaScript function takes 4 parameters (which are expected to be
integers). The idea of passing a single parameter and parsing it on the
client has occurred to me, but since I am sure I am not the only person
who has situations that require more than one parameter, I was hoping
there would be an easier way. Any ideas? Thanks.

AJAX doesn't mean much. Do you use SOAP, or a simple ASHX custom handler,
or something else?

With SOAP, you can pass an object back to the JavaScript client. Note
that unless you use a library doing that for you (for example ASP.NET
AJAX formerly known as ATLAS), you must parse the result yourself.

If you use a custom handler, you can return XML in the response, and then
parse the received XML. Nothing prevents you then to define your own XML
format to pass any number of parameters to the script.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch


Nov 20 '06 #4
I've done what you are describing in my WebChat control.
The included source code and article should provice all you need:
http://SteveOrr.net/articles/WebChat.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:eK**************@TK2MSFTNGP06.phx.gbl...
>I am a beginner with AJAX, and have managed to learn how to use it when
passing single parameters, but I want to return more than one value to the
client-side JavaScript function that displays it. My client-side JavaScript
function takes 4 parameters (which are expected to be integers). The idea
of passing a single parameter and parsing it on the client has occurred to
me, but since I am sure I am not the only person who has situations that
require more than one parameter, I was hoping there would be an easier way.
Any ideas? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 20 '06 #5

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

Similar topics

0
by: Naveed Anwar Kharadi | last post by:
From: "Naveed Anwar Kharadi" <n-anwar@corrtec.com> Subject: Passing a Collection object to a COM+ Server application. Date: Thursday, May 20, 2004 12:43 PM Hi, I am trying to develop a COM+...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
2
by: pyrexia | last post by:
Greets all. I'm attempting to write an app that will be used as a 'control/launcher' application for other apps. For the sake of argument let's say the app is launched from a command line: ...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
60
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
16
by: Theo R. | last post by:
Hi all, Does the C99 Standard explicitly mention the need for a stack for passing arguments or Is this platform specific? As an example, the ARM9 processor recommends Core Registers R0-R3 be...
1
by: Jean Paul Mertens | last post by:
Hello, Is there a simple way for passing arguments to applications deployed with ClickOnce and having off-line capabilities. My app takes arguments if I start it with the whole path to it...
5
by: goldtech | last post by:
Hi, I'm passing what I think is a string parameter to another Python program (spawn.py) - see the code snip below. But only the counter part gets printed to a log file via spawn.py. Yet the...
0
by: sashaxp | last post by:
Hi, Is it possible to pass client's certificate through multiple hops. Let me describe desirable scenario: some client (might be in any platform) that located outside domain attach...
2
by: Israel | last post by:
It seems like there should be a way to pass events around like delegates but on the other hand they’re sort of special delegates because the only one allowed to invoke them is the owner of the...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.