"not well-formed" warning when loading client-side JSON in Firefox via jQuery.ajax
Posted
by Zhami
on Stack Overflow
See other posts from Stack Overflow
or by Zhami
Published on 2010-04-11T22:29:30Z
Indexed on
2010/04/11
22:33 UTC
Read the original article
Hit count: 743
jquery-ajax
|firefox3.6
I am using jQuery's ajax method to acquire a static JSON file. The data is loaded from the local file system, hence there is no server, so I can't change the mime type.
This works fin in Safari, but Firefox (3.6.3) reports the file to be "not well-formed". I am aware of, and have reviewed, a similar post here on Stack Overflow:
I believe my JSON is well-formed:
{
"_": ["appl", "goog", "yhoo", "vz", "t"]
}
My ajax call is straightforward:
$.ajax({
url: 'data/tickers.json',
dataType: 'json',
async: true,
data: null,
success: function(data, textStatus, request) {
callback(data);
}
});
If I wrap the JSON with a document tag:
<document>JSON data</document>
as was mentioned in the above referenced posted question, the ajax call fails with a parserror.
So: is there a way to avoid the Firefox warning when reading in client-side JSON files?
© Stack Overflow or respective owner