Hi,
I am having trouble with the .getJSON method. When I use the flickr URL given in one of the examples, it works just fine. However, whenever I try to capture my own JSON, it hits the .error method.
Here is the call to getJson:
- var jqxhr = $.getJSON("http://localhost:5002", function() {
- alert("success");
- })
- .success(function() { alert("second success"); })
- .error(function() { alert("error"); })
- .complete(function() { alert("complete"); });
I have a homemade TCP server (don't ask) that serves up JSON on this port of my local machine. When I hit that port with FF, I receive valid JSON with no problems. I have successfully the same JSON from a file using .getJSON and have also parsed it using .parseJSON.
Is it possible to use .getJSON to hit a local socket and retreive JSON data? As far as I can tell, the HTTP Header is formatted properly. I have tried every MIME type that I can think of (w/ application/json as my default), the length in the header is accurate, and FireBug sees the data as JSON.
If it is possible to pull JSON data from a local socket, do you all have any other ideas?