[eluser]I666I[/eluser]
Quote:To access the server response, use request.responseText, to find out the HTTP status, use request.status.
derrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
to clarify in case someone else is wondering: uh, the controller that gets called in the js (Ajax.request) is where the backend stuff happens (which we all already knew, uh, right?). You can simply put an echo in there or print_r or whatever and that'll be in the responseText via the parameters (e.g.
Code:
function submit$i(){
var options = {
method:'post',
postBody:'link=$link&linkDate;=$linkDate&transDesc;=$transdesc&transID;=$transid&zoomyID;=$crikeyID123',
onCreate: function() {
var container_div = $('updatingDiv$i');
container_div.update('<b>Loading....</b>');
},
onSuccess: function(transport){
var container_div = $('completeDiv$i');
container_div.update('<b>Crikey Deleted</b>');
var response = transport.responseText;
alert("Response is: " + response);
},
onComplete: function(transport){
var container_div = $('updatingDiv$i');
Effect.toggle('transDiv$i','appear', { delay: 1.0 });
container_div.update('');
},
onFailure: function(){ alert('Something went wrong...')}
}
new Ajax.Request('/radicalURI/DeleteJAX/$crikey/$zoom',options);
};
) to be alerted or trigger stuff or make you dinner or whatever. you can see it in the onSuccess function:
Code:
onSuccess: function(transport){
var container_div = $('completeDiv$i');
container_div.update('<b>Crikey Deleted</b>');
var response = transport.responseText;
alert("Response is: " + response);
},
zoom!