Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Passing multiple arguments to the client-side JavaScript function in AJAX

Reply
Thread Tools

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

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      11-20-2006
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
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/


 
Reply With Quote
 
 
 
 
Laurent Bugnion
Guest
Posts: n/a
 
      11-20-2006
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
 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      11-20-2006
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
(E-Mail Removed)
http://www.nathansokalski.com/

"Laurent Bugnion" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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



 
Reply With Quote
 
Michael Schwarz
Guest
Posts: n/a
 
      11-20-2006
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" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> 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
> (E-Mail Removed)
> http://www.nathansokalski.com/
>
> "Laurent Bugnion" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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

>
>



 
Reply With Quote
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      11-20-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
> (E-Mail Removed)
> http://www.nathansokalski.com/
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
functions and arguments.length; passing unknown number of arguments oldyork90 Javascript 10 09-27-2008 03:05 AM
how to pass a function name and its arguments inside the arguments of other function? jmborr Python 1 11-03-2007 08:20 AM
Passing a tuple to a function as multiple arguments Ben Warren Python 1 09-07-2007 03:22 AM
Passing multiple arguments to the client-side JavaScript function in AJAX Nathan Sokalski ASP .Net 4 11-20-2006 06:27 PM
function call with arguments which takes no arguments Neo C Programming 10 01-20-2005 06:31 AM



Advertisments