I am doing a json request on what appears to be a Facebook API page. However, the json is prefaced with for (;;);
which is ruining jQuery's attempt to process it.
How can I slice off these unwanted characters? Can I use the dataFilter
property of the $.ajax
call?
My test code is:
$.ajax({
url: 'http://www.facebook.com/ajax/typeahead_friends.php',
data: {u: userid, __a: 1},
callback: function(data, status) {
alert(data);
//alert(data.payload.friends);
},
dataFilter: function(data,type) {
alert(data);
return data;
},
dataType: 'json'
});
However, the dataFilter
function is being given an empty string. Am I doing something wrong?