SCRIPT65535: Argument not optional - Solution to a IE11 problem with Ajax Data
A list of JavaScript reserved words:
When choosing names for your JS variables, avoid using these reserved words:
While developing a web page to house a window frame optimising tool, an issue with jQuery Ajax Data presented itself that resulted in 2 days of researching, testing and wondering why IE11 was throwing a 'SCRIPT65535: Argument not optional' error. Below, Fig1, is the jQuery script that was being run to retrieve results from a complex algorithm on a separate PHP page called optimiseCalc.php...

Fig 1. IE11 hangs & throws a 'SCRIPT65535: Argument not optional' error running this code.
The above script worked fine in Firefox, Opera, Safari & Chrome browsers but just hung in IE11! I used google search to try and find a reason why this was the case but just couldn't come up with anything definitive. So, after many attempts at plugging in this & pulling out that I finally discovered why it was behaving this way.
It was in the Ajax DATA contents - the fact that a JavaScript identifier/reserved word, 'frames', was being used as a variable name! - simple as that. For example, if I changed the original Ajax data {StandardLength:StandardLength,frames:frames} to {StandardLength:StandardLength,frames:fr} where, instead of using 'frames' as a variable name I used 'fr', it would now run correctly in IE11.

Fig 2. This code runs fine in IE11.
In conclusion:
In order to get IE11 (or indeed other versions of IE?) to run the Ajax function correctly make sure that the Ajax Data VARIABLE name is not a JavaScript indentifier or reserved word name.
A list of JavaScript reserved words:
When choosing names for your JS variables, avoid using these reserved words:

The following are also words to avoid as they are names of JavaScript variables. These are predefined names of implementation-dependent JavaScript objects, methods, or properties and is where 'frames' is listed...

Comments
Display comments as Linear | Threaded
Ned Edgehill on :