473,811 Members | 3,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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********@hotm ail.com
http://www.nathansokalski.com/
Nov 20 '06 #1
4 4297
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 ICallbackEventH andler interface by including the following
line:
Implements ICallbackEventH andler

This interface includes implementing the following method and function:
Public Sub RaiseCallbackEv ent(ByVal eventArgument As String) Implements
ICallbackEventH andler.RaiseCal lbackEvent
Public Function GetCallbackResu lt() As String Implements
ICallbackEventH andler.GetCallb ackResult
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********@hotm ail.com
http://www.nathansokalski.com/

"Laurent Bugnion" <ga*********@bl uewin.chwrote in message
news:%2******** ********@TK2MSF TNGP03.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********@hot mail.comschrieb im Newsbeitrag
news:Oj******** ******@TK2MSFTN GP02.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 ICallbackEventH andler interface by including the following
line:
Implements ICallbackEventH andler

This interface includes implementing the following method and function:
Public Sub RaiseCallbackEv ent(ByVal eventArgument As String) Implements
ICallbackEventH andler.RaiseCal lbackEvent
Public Function GetCallbackResu lt() As String Implements
ICallbackEventH andler.GetCallb ackResult
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********@hotm ail.com
http://www.nathansokalski.com/

"Laurent Bugnion" <ga*********@bl uewin.chwrote in message
news:%2******** ********@TK2MSF TNGP03.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********@hot mail.comwrote in message
news:eK******** ******@TK2MSFTN GP06.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********@hotm ail.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
1117
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+ Server Application, using C#.Net, that accepts a ListDictionary object in one of its method arguments; but when the client makes a call to this method there raises an error saying "Insufficient state to deserialize the object. More information is...
7
2872
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 parameter to the XSLT stylesheet XsltArgumentList xsltArgList = new XsltArgumentList(); xsltArgList.AddParam("pmID", "", pmID); xmlItems.TransformArgumentList = xsltArgList;
2
4284
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: controlapp externalapp argument1 argument2 argument3 argument4...etc. (number of arguments is ALWAYS dynamic) I'm been able to get the array passed properly, but ONLY when I know in advance the amount of items in the array. I'm stuck on how to...
12
5344
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 the custom employee class and have built it as a separate library (employee.dll). This employee.dll is being referenced by both the web service and the windows application. I face the following problem when I send this class to the webservice.
60
4952
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 'target' programming community herein) to get some community input and verify (or not) the following two statements. Few programmers (3 to7%) UNDERSTAND 'Strategic Functional Migration
16
3395
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 used when passing less than four parameters. However some compilers for ARM9 do not follow this recommendation and place all parameters on the stack. Therefore, the question arises if the compilers were following the C Standard instead.
1
4265
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 "c:\whole\path\myapp.exe /arg=123" but as I do not know where the application reside on the client PC's I don't know the whole path. Is there a way to do so by a system-variable as %the_path_to_your_app% or
5
3321
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 echo print to the output window shows the whole string with the fc part. Better explained below I hope, there's the calling .py and the spawn script .py: ....snip... while fc:
0
1142
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 certificate to message and pass request to wcf service that is located outside domain as well which have to extract client certificate and create it's own request to another wcf service located inside domain based on ws-security (so it should place client's
2
1596
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 event. What I want to do is create a generic event forwarder that forwards events from a server to a client. It will only subscribe to the server events once and only if there’s at least one client subscriber. Once the last client subscriber...
0
10644
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10394
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10127
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9201
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6882
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.