Thursday, 15 August 2013

javascript - jQuery ajax not returning the whole object -



javascript - jQuery ajax not returning the whole object -

whenever :

$.ajax({ //my settings }).done(function(data){ // publish or store info });

it works fine! however, i'm trying apply observer pattern, because i'm required to, when do, using code:

$.ajax({ // settings }).done(function(data){ $(document).trigger('allready',data); }); // other part of code $(document).on('allready',function(e,data){ console.log(data); // why?! });

the response (data) storing first value, not whole array, first example, did break functionality?

ps: note though it's returning first value of supposedly big array, when seek utilize it, won't allow me, however, can log it.

since data array, each individual piece sent separate argument in event callback. it's unusual because if data object not case (you'd able utilize data).

instead, utilize data = arguments.slice(1)

javascript jquery ajax

No comments:

Post a Comment