I have searched here and on Google, but as an inexperienced Javascript hack I'm struggling to find a good example of what I believe is a rather straight forward action.
I have a server-side script that I have coded to provide JSON formatted output (content.php?action=json).
The JSON output is multi-dimensional, ie it is formatted as ...
[Content]
[Class 1]
[Entry 1]
[Entry 2]
[Entry 3]
...
[Class 2]
[Entry 1]
[Entry 2]
...
Both the number of classes and entries are variable.
I am now trying to write a simple Javascript to do the following ...
1) Call my PHP script
2) Copy the returned JSON output into a suitable Javascript array
3) Display parts of this array within my HTML pages
There are a number of "bits" of this puzzle, but I am struggling to put this together. Would anyone put a simple example together for me?
A couple of side questions ...
(i) Does the output file containing the JSON data need to have it's HTML headers altered to indicate it's content type?
(ii) Is jQuery the best approach for this sort of thing?
Thanks in advance. Pete