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

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default 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
    [email]njsokalski@hotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]


    Nathan Sokalski Guest

  2. Similar Questions and Discussions

    1. Client-Side Validation of asp:TextBox with Javascript
      Hi - I'm trying to do client-side validation of the text in a Asp.Net textbox control using javascript. My page has the following: <form...
    2. Hit Counter in Javascript on client side.
      Have opportunity to use free web server space but can only use client scripting. How to code hit counter in javascript? Any help would be...
    3. Controls with a client side onLoad function or seting a cursor server side
      Is there any way to create a web control that calls a client side onLoad function? Its diffucilt since you are not able to access the form or...
    4. Client-side Javascript validation of "select multiple" for PHP
      Has anyone here ever done a case where you have a select multiple form element and you have to do both server-side and client-side validation? I...
    5. Loading client-side images for use in Javascript
      Ok, I'll play the dumb guy.... if your script is running on the server under the testapp application, why isn't the source 'Images/down.gif' (Path...
  3. #2

    Default Re: Passing multiple arguments to the client-side JavaScript functionin AJAX

    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: [url]http://www.galasoft-LB.ch[/url]
    PhotoAlbum: [url]http://www.galasoft-LB.ch/pictures[/url]
    Support children in Calcutta: [url]http://www.calcutta-espoir.ch[/url]
    Laurent Bugnion Guest

  4. #3

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

    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
    [email]njsokalski@hotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]

    "Laurent Bugnion" <galasoft-lb@bluewin.ch> wrote in message
    news:%23RhOuAHDHHA.4404@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: [url]http://www.galasoft-LB.ch[/url]
    > PhotoAlbum: [url]http://www.galasoft-LB.ch/pictures[/url]
    > Support children in Calcutta: [url]http://www.calcutta-espoir.ch[/url]

    Nathan Sokalski Guest

  5. #4

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

    Hi,

    with Ajax.NET Professional ([url]http://www.ajaxpro.info/[/url]) 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

    [url]http://weblogs.asp.net/mschwarz/[/url]
    [url]http://www.ajaxpro.info/[/url]




    "Nathan Sokalski" <njsokalski@hotmail.com> schrieb im Newsbeitrag
    news:OjQ6ijLDHHA.3492@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
    > [email]njsokalski@hotmail.com[/email]
    > [url]http://www.nathansokalski.com/[/url]
    >
    > "Laurent Bugnion" <galasoft-lb@bluewin.ch> wrote in message
    > news:%23RhOuAHDHHA.4404@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: [url]http://www.galasoft-LB.ch[/url]
    >> PhotoAlbum: [url]http://www.galasoft-LB.ch/pictures[/url]
    >> Support children in Calcutta: [url]http://www.calcutta-espoir.ch[/url]
    >
    >

    Michael Schwarz Guest

  6. #5

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

    I've done what you are describing in my WebChat control.
    The included source code and article should provice all you need:
    [url]http://SteveOrr.net/articles/WebChat.aspx[/url]

    --
    I hope this helps,
    Steve C. Orr,
    MCSD, MVP, CSM, ASPInsider
    [url]http://SteveOrr.net[/url]


    "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
    news:eK3CIYFDHHA.4144@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
    > [email]njsokalski@hotmail.com[/email]
    > [url]http://www.nathansokalski.com/[/url]
    >

    Steve C. Orr [MVP, MCSD] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139