Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-23-2009, 12:52 PM   PM User | #1
vkdixit
New Coder

 
Join Date: Nov 2008
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
vkdixit is an unknown quantity at this point
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;
}
});
vkdixit is offline   Reply With Quote
Old 03-23-2009, 01:09 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,752
Thanks: 4
Thanked 2,468 Times in 2,437 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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'); 
Fou-Lu is offline   Reply With Quote
Old 03-23-2009, 03:30 PM   PM User | #3
ohgod
Regular Coder

 
ohgod's Avatar
 
Join Date: Jun 2008
Location: Ohio
Posts: 579
Thanks: 6
Thanked 69 Times in 69 Posts
ohgod is on a distinguished road
that looks like prototype to me.

what exactly are you trying to accomplish?
ohgod is offline   Reply With Quote
Old 03-24-2009, 04:28 AM   PM User | #4
bdl
Regular Coder

 
Join Date: Apr 2007
Location: Camarillo, CA US
Posts: 590
Thanks: 4
Thanked 83 Times in 82 Posts
bdl is an unknown quantity at this point
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);
  }
} );
bdl is offline   Reply With Quote
Old 03-25-2009, 03:07 PM   PM User | #5
ohgod
Regular Coder

 
ohgod's Avatar
 
Join Date: Jun 2008
Location: Ohio
Posts: 579
Thanks: 6
Thanked 69 Times in 69 Posts
ohgod is on a distinguished road
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..
ohgod is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 01:07 AM.


Advertisement
Log in to turn off these ads.