No, JSON is the correct route. If you are using ajax to retrieve
json, then you can pull the json into a javascript object
immediately. If you are using PHP to generate pages, then you can
print out the JSON object as a string directly into javascript and
create javascript objects that way. jQuery has built in methods
to .getJSON that provides the basis of all my AJAX calls in the web
app I work on.
Another tip, standardize all the JSON responses into a format you
like, for example
{
'header': {
'type': String,
'message': String
},
'payload': {
'data': []
}
}
That way you can create one object that calls .getJSON and use that
object to do all of your ajax calls and have a standard set of
responses to being timed out, 404 errors, loading alert while the ajax
call is running, etc.
Good luck.