I've be开发者_开发问答en pulling my hair out over this;
function status_update( token, loader ){
$("#status-submit").bind( 'click', function(){
try{
$("#status-feed-result").html( loader );
$("#status-input").attr("disabled", "disabled");
var status_input = $("#status-input").val();
$.ajax({
type: 'POST', url: './', data: 'token=' + token + '&refresh=true&status-input=' + status_input + '&aj=true', cache: false, timeout: 5000, datatype: 'json',
error: function(){ $("#status-input").removeAttr('disabled'); },
success: function(html){
auth(html);
$("#status-input").removeAttr('disabled');
$("#status-input").val('');
var JSON = eval(html);
alert(JSON.PROFILE_STATUS);
//$(".status-p").html( JSON.PROFILE_STATUS );
//$(".time").html( JSON.PROFILE_STATUS_TIME );
}
});
}catch(err){}
return false;
});
}
I keep getting an error invalid label, what does this mean and how can I prevent from happening. Any help much appreciated.
Sounds like it could be related to a jQuery repeat ajax call bug listed here: jQuery Bug #8398
It turns out that jQuery 1.5 is modifying subsequent ajax calls for json to jsonp which leads to this error.
I fixed it by following one of the workarounds suggested in the bug change history and placing the following code somewhere before my ajax calls are made:
$.ajaxSetup({
jsonp: null,
jsonpCallback: null
});
Should fix any problems for other ajax requests too.
I got this error when I wasn't specifying the success() function correctly. Try doing the following code where data is whatever information your passing back:
success : function(data,status,response){
EDIT:
My error was actually there because I was using a plug-in called validate.js. If you're using this plug-in and including validate.pack.js, this could be your problem.
精彩评论