Bear Bibeault wrote:P.S. You should be using jQuery to do your Ajax. Much simpler and more robust.
Thank you, I've just started learning ajax using jQuery.
Bear Bibeault wrote:Have you used the browser's debugger to see what the response text is? Is it valid JSON?
Please can I get some more explanation here as I'm not aware of how to use the browser's debugger to see the response.
I tried opening the link in the code above which is http://www.tutorialspoint.com/json/data.json and I got some valid JSON. Please explain.
Note how it works fine on that example page, because both HTML/JS and JSON URLs are on the same domain. If you want to run the HTML/JS locally, you also need to have the JSON locally (and change the JS code accordingly).
By the time they've advanced to using Ajax, they should be get familiar with the Network tools in the browser. Otherwise, they are flying blind.
And in my opinion, use the Chrome debugging tools as the first line of defense. I find them somewhat superior to Firebug.