vkdixit
03-23-2009, 12:52 PM
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;
}
});
Fou-Lu
03-23-2009, 01:09 PM
I'm guessing this is from a JS framework of some sorts.
Java is not the same as javascript. Moving to AJAX forum.
ohgod
03-23-2009, 03:30 PM
that looks like prototype to me.
what exactly are you trying to accomplish?
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:
$.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);
}
} );
ohgod
03-25-2009, 03:07 PM
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
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