0

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?

1
  • Does anyone else laugh to themselves a little when they hear AJAX refer to a function which is not asynchronous, and does not use xml? Commented Jul 25, 2011 at 19:06

1 Answer 1

3

Try taking out the comma after

async: false 

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the quick feedback. That did indeed resolve my issue. Many times in life it is the very smallest of things that cause the most problems.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.