If the expected format is: [{...}] then isn't your example above missing the outermost array? The PHP data returned currently is {...}.

This could be resolved in the PHP with:

echo $_GET['callback']. '(['. json_encode($array) . '])';

Or in the JS with:

data = [input]


I think you have to replace this:

echo $_GET['callback']. '('. json_encode($array) . ')';


echo json_encode($array);

If you need to join the "callback" array with the $array, you have to do programmatically and not treating like strings....

Hope this helps.

More Query from same tag