Welcome Guest, Not a member yet? Register   Sign In
pseudo (or real) ajax db and view updating?
#7

[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!


Messages In This Thread
pseudo (or real) ajax db and view updating? - by El Forum - 09-28-2009, 08:52 AM
pseudo (or real) ajax db and view updating? - by El Forum - 09-28-2009, 06:30 PM
pseudo (or real) ajax db and view updating? - by El Forum - 09-29-2009, 04:10 AM
pseudo (or real) ajax db and view updating? - by El Forum - 09-29-2009, 05:58 AM
pseudo (or real) ajax db and view updating? - by El Forum - 09-30-2009, 07:42 AM
pseudo (or real) ajax db and view updating? - by El Forum - 09-30-2009, 01:51 PM
pseudo (or real) ajax db and view updating? - by El Forum - 10-01-2009, 02:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB