开发者

JQuery AJAX fails with IE

I have 开发者_如何学Goa function for doing ajax calls (line numbers supplied):

9 function doAjax(url, args){
10    var retVal;
11    retVal =   $.ajax({  
12                    type: "GET",
13                    url: url,
14                    data: args,
15                    async: false,
16                }).responseText;
17    if(retVal==null || retVal=="")retval=99;
18    return retVal;
19 }

When I use IE8, I get an error stating:

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB7.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDR; .NET4.0C; .NET4.0E) Timestamp: Mon, 25 Jul 2011 17:45:36 UTC

Message: Expected identifier, string or number

Line: 17

Char: 21

Code: 0

URI: local host web server

This script works perfectly fine with FireFox. Being a novice, I am at a loss as to why this is generating an error. Can anyone point me in the right direction?


Try taking out the comma after

async: false

Putting a comma after the last member of an object can cause IE to freak out.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜