everytime my page loads, im supposed to create a datatable (also a jquery plugin)
but when im fetching the contents, using .ajax or .getJSON always goes straight ahead to the error function, without even telling me what went wrong inside the callback
$.ajax({
cache: false,
type: "POST",
url: oSettings.sAjaxSource,
data: {'newdate' : date},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(json) {
console.log('retrieving json data');
},
error: function() {
console.log("An error has occurred. Please try again.");
}
});
that’s the actual code with the callback stripped for security purposes…
this works fine in firefox which actually executes what’s on the callback function
but IE simply fails and proceeds to writing my log
i’ve read alot that the primary reason the JSON calls fails for IE is whenever there are trailing commas or simply malformed JS
but i used JSONLint already and verified that my json object is a valid one 🙁
Try this
The better choice is to use json2.js to ensure that there is a valid JSON implementation resident and then serialize your data before calling ajax
Do not rely on jquery to do this for you.