开发者

Invalid regular expression flag b on property list sending AJAX request

开发者 https://www.devze.com 2023-02-01 04:53 出处:网络
I am trying to run the code: runrequest = function () { $.ajax({ url: \'ajax.php\', success: function(data) {

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消