tags:

views:

18

answers:

1

Hi, is it possible to get access to the postanswer?

For exmaple:

This is my post

$.post('test.php', {mx: 'alpha_one', ft: 'get_it', 'values[0]':'25', 'values[1]':'10'},
function(data_lv)
{

.....

}, 'json'); 

and this is the answer

{"bibo":"3733c0f973590e579b78f1473fb96fbe","success":true,"data":{"1":"bernd","52":"blub","135":"blib","133":"Cleack","115":"Cl2"},"msg":"bluub"}

i can check every poststop with

$(window).ajaxStop(function(data_lv)
{


}, 'json'); 

but how can i check the bibo?

$(window).ajaxStop(function(data_lv)
{

   alert(data_lv.bibo); // <---- DONT WORK

}, 'json'); 

Hope someone can help me.

Thanks in advance! Peter

A: 

If i get it right, you are doing a post to a php file, and then want to check if it was executed succesfully.

what I do i: execute the php function, and encapsulate it with a try catch.

if it worked, return the data, else retur a "false". then in my post I do:

$.post('ajax/test.html', function(data) {
  if(data != "false"){
   //execute your succes thingys
  }
});

you can read more about the post function and handling the succes here

Nealv
Hi Nealy, i search a clean method to check all post on my webpage with only one sulotion. I think poststop is the right way ... ?
Peter
aaaaaaaaah now I understand :)
Nealv
ow about you write a custom generic post function. and then instead if calling your post function, call your custom function that triggers the post. (kind of like extending the jquery post function)
Nealv