radi8
radi8

Reputation: 526

JQuery AJAX fails with IE

I have a 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?

Upvotes: 0

Views: 405

Answers (1)

shelman
shelman

Reputation: 2699

Try taking out the comma after

async: false

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

Upvotes: 3

Related Questions