We want all of our AJAX calls in our web app to receive JSON-encoded content. In most places this is already done (e.g. in modals) and works fine.
However, when using j
I had to add:
this.dataTypes=['html']
to get this to work.
In context:
,ajaxOptions: {
dataFilter: function(result,type){
var data = $.parseJSON(result);
// Trick jquery to think that it's html
this.dataTypes=['html']
return ''+data.credential.id+'
';
}
,error: function( xhr, status, index, anchor ) {
$( anchor.hash ).html( i18n.AJAXError + ' (' + status + ')' );
}
}