Pretty simple ajax call
var self = this;
$.ajax({
url:'specs.json',
datatype: 'text/json',
async: false,
success: function(data) {
self.specsData = data;
cb();
},
error: function(textStatus, errorThrown) {
console.log(errorThrown);
console.log(textStatus);
}
});
I threw the error in because it had been a few hours and I couldn't figure out why I was still getting a parseerror message.
I was using iis. I had added the json mime type but it still was throwing this error.
I hit the IIS logs finally after I wanted to make sure it truley was returning a 200 like the browser was showing in "errorThrown" message.
2015-08-18 20:22:49 ::1 GET /JStest/specs.json - 80 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/44.0.2403.155+Safari/537.36 304 0 0 0
What? 304? WTF is 304?
Not Modified 304
If the client has done a conditional GET and access is allowed, but the document has not been modified since the date and time specified in If-Modified-Since field, the server responds with a 304 status code and does not send the document body to the client.Response headers are as if the client had sent a HEAD request, but limited to only those headers which make sense in this context. This means only headers that are relevant to cache managers and which may have changed independently of the document's Last-Modified date. Examples include Date , Server and Expires .
The purpose of this feature is to allow efficient updates of local cache information (including relevant metainformation) without requiring the overhead of multiple HTTP requests (e.g. a HEAD followed by a GET) and minimizing the transmittal of information already known by the requesting client (usually a caching proxy).
Ok. So despite adding the mime type. The browser was told ,"I gave you the file. Use your cache."
So the cached version of the json still had the wrong mime type.
Closed and reopened Chrome. Works perfectly.