I am trying to run the code:
runrequest = function () {
$.ajax({
url: 'ajax.php',
success: function(data) {
proccessrequest(true,eval(data));
},
error: function(data) {
proccessrequest(false,eval(data));
}
});
}开发者_开发问答
For some reason whenever I run this code Firebug gives me the error:
invalid regular expression flag b
},
This is referring to the }, after the success function. I am clueless of why this wouldn't work.
EDIT: The return data is ajax is JSON. The json is wrapped in parentheses
You're most likely getting an error back. The error message has the invalid expression.
For example if your error contains bold Warning: < /b >
then there it is.
The line number is off here, more likely your error is eval(data)
, and that data has something like:
var regex = /expr/b
in there, which isn't a valid flag.
精彩评论