michael.dewitt.716 15 Newbie Poster

Thanks cereal, once you said that it was jsonp, i was able to refine my search. In the end, i came across this function that seem to work really well:

function jsonp_decode($jsonp, $assoc = false) { // PHP 5.3 adds depth as third parameter to json_decode
    if($jsonp[0] !== '[' && $jsonp[0] !== '{') { // we have JSONP
       $jsonp = substr($jsonp, strpos($jsonp, '('));
    }
    return json_decode(trim($jsonp,'();'), $assoc);
}

print_r(jsonp_decode($res, true));

This was a featured post when i donated, but i dont know why its not showing as one. Thanks again for all your help and pointing me in the right direction.

cereal commented: You're welcome! +15
michael.dewitt.716 15 Newbie Poster

Hi,
im assuming this is javascript and not php.
Second, do you want to call a function every xx minutes via ajax? If so, just set the interval and call the function in it.

setInterval(ajaxCall, 300000); //300000 MS == 5 minutes

function ajaxCall() {
    //do your AJAX stuff here
}

or delete line 16 since its an extra bracket and move the miliseconds to line 17 between the parenthesis and bracket
}, 15000);

post back and let us know.