You could declare a function and give it a name, instead of using an anonymous function, then pass that as the success function for each ajax call.
- Richard On Dec 14, 2007 8:51 AM, Mario Moura <[EMAIL PROTECTED]> wrote: > No. > > Let me explain better. > > In your scenario you made a individual AJAX request and into this request > you create rules. > > But JQuery could create an universal AjaxSucess to test all data from all > ajax requests. > > So imagine this scenario: > > The page have a lot of AJAX requests, something like ajaxform, $.ajax, > $.post, $.get > > So from response of each AJAX we could create a function like: (and I will > use switch) > > > $().ajaxSuccess (function() { > switch( $(data).attr("id") ) { // here I get the data from AJAX > Sucess every time happen could by by xml, json but I am using div > case 'myid': > // do stuff with data; > break; > case 'myid2': > // do stuff with data; > break; > } > > no matter if it is from $.ajax({"type": "POST", "url": " foo1.php ",}); > or $.ajax({"type": "POST", "url": "foo2.php "}); or $.ajax({"type": > "POST", "url": "foo3.php ",}); > > But at this moment. I think is not possible. But could be a good improve. > > Did you understand? > > Regards > > Mario Moura > > 2007/12/14, Giovanni Battista Lenoci <[EMAIL PROTECTED]>: > > > > > Don't know if I understood, > > > > $.ajax({"type": "POST", > > "url": " foo2.php", > > "data": data, > > "dataType": "json", > > "success": function(server_response) { > > switch(server_response.wich_function) { > > case '1': > > on_success_one(server_response); > > break; > > case '2': > > on_success_two(server_response); > > break; > > } > > > > }); > > > > > > > -- > Mário Alberto Chaves Moura > [EMAIL PROTECTED] > 31-3264-6203 > 31-9157-6000