jquery ajax call returning error when its not an error
- by azz0r
Hello,
My JS Is:
$(InitFavorite);
function InitFavorite(){
var jList = $(".favourite_link");
var ids_to_check = {};//new Array();
$.each(jList, function () {
var id = this.id;
var object = id.split("_");
if (!ids_to_check[object[1]]) {
ids_to_check[object[1]] = [];
}
ids_to_check[object[1]].push(object[0]);
});
//console.log(ids_to_check);
$.ajax({
type: 'POST',
url: '/user/subscription/favourite-listing',
data: ids_to_check,
dataType: 'json',
beforeSend: function(x) {
if(x && x.overrideMimeType) {
x.overrideMimeType("application/j-son;charset=UTF-8");
}
},
error: function() {
alert(1);
},
success: function() {
alert(2);
/*$each(returned_values, function() {
alert('boom');
});*/
}
});
}
From the ajax call, the following data is returned:
{"env":"development","loggedIn":true,"translate":{}}{"Playlist":{"10":"Stop Recieving Updates For This Playlist"},"Clip":{"26":"Recieve Updates For This Clip","27":"Recieve Updates For This Clip","28":"Recieve Updates For This Clip","29":"Stop Recieving Updates For This Clip","30":"Recieve Updates For This Clip"}}
However, success is never triggered, just error, despite there being no header and json being put out as the header (via zend framework).
Ideas?