jquery trouble with getJSON call.

Posted by Yo-L on Stack Overflow See other posts from Stack Overflow or by Yo-L
Published on 2010-05-28T14:21:35Z Indexed on 2010/05/28 14:31 UTC
Read the original article Hit count: 186

Filed under:
|

Hi guys. Got some basic problem again.

I need to modify a function that previously returned a in code written object. Im now trying to get the object from json through $.getJSON

   function getEventData() {
       var result = '';

       $.getJSON("ajax.php?cmd=getbydate&fromdate=&todate=", function(data){
           result = data; 
       });
       return result;
   }

Problem is that result isn't set in the callback function for obvious reasons.

Do you guys have a solution for this?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JSON