Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Nov 2008
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how we pass more than one parameter in ajax.request

    Hi all,
    Plz help me how we pass the parameter in ajax.request and get the oncomplete text...........


    var ajaxc = new Ajax.Request('/bc/krnlAddComment1.asp?ID=<%=request("ID")%>comment=comm&name=myname',{
    method: 'get',
    parameters: 'true',
    onSuccess: function handleresponsemess(request)
    {
    alert('great');
    return false;
    }
    });

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    I'm guessing this is from a JS framework of some sorts.
    Java is not the same as javascript. Moving to AJAX forum.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Regular Coder ohgod's Avatar
    Join Date
    Jun 2008
    Location
    Ohio
    Posts
    579
    Thanks
    6
    Thanked 69 Times in 69 Posts
    that looks like prototype to me.

    what exactly are you trying to accomplish?

  • #4
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    I'm assuming the OP is referring to sending the query string data, namely ID, comment and name to the request. As Fou-Lu mentioned, this is obviously a call to some framework's Ajax request, so the documentation on that framework should spell it out. For example, here's how you would do it in jquery:
    Code:
    $.ajax( {
      type : "POST",
      url : theUrl,
      data : "ID=theID&comment=comment&name=theName",
      success : function(data) {
        $("#returnData").append("<p/>").html(data);
      },
      failure : function(err) {
         console.log(err);
      }
    } );

  • #5
    Regular Coder ohgod's Avatar
    Join Date
    Jun 2008
    Location
    Ohio
    Posts
    579
    Thanks
    6
    Thanked 69 Times in 69 Posts
    ooohh... don't attach your parameters to your url string. the url string should just be your target file. you CAN technically do it that way i think... but i'd suggest following the api docs. instead of using parameters = "true" (which isn't right) use parameters: 'ID=<%=request("ID")%>comment=comm&name=myname'

    the returned text will be in transport.responseText

    so

    Code:
    var ajaxc = new Ajax.Request('/bc/krnlAddComment1.asp',{
    method: 'get',
    parameters: 'ID=<%=request("ID")%>comment=comm&name=myname',
    onSuccess: function (transport)
    { 
    alert(transport.responseText);
    }
    });
    http://www.prototypejs.org/api/ajax/request
    Last edited by ohgod; 03-25-2009 at 03:10 PM.


  •  

    Posting Permissions

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