Firefox Javascript Syntax Error Popup
Contents |
& Guides Learn the Web Tutorials References Developer Guides Accessibility Game development ...more docs Mozilla Docs Add-ons Firefox WebExtensions Developer ToolsFeedback Get logic error Firefox help Get web development help Join the MDN community Report a
How To Fix Syntax Error
content problem Report a bug Search Search Languages Català (ca) Deutsch (de) Español (es) Français (fr) 日本語
Semantic Error
(ja) 한국어 (ko) Português (do Brasil) (pt-BR) Русский (ru) 中文 (简体) (zh-CN) Add a translation Edit Advanced Advanced History Print this article MDN Web technology For developers JavaScript JavaScript reference Standard
Syntax Error In Programming
built-in objects SyntaxError Your Search Results fscholz Mingun arai Sheppy Potappo Sevenspade SyntaxError In This Article DescriptionSyntaxParametersPropertiesMethodsSyntaxError instancesPropertiesMethodsExamplesCatching a SyntaxErrorCreating a SyntaxErrorSpecificationsBrowser compatibilitySee also The SyntaxError object represents an error when trying to interpret syntactically invalid code. Description A SyntaxError is thrown when the JavaScript engine encounters tokens or token order that does not conform to the syntax of the language syntax error javascript when parsing code. Syntax new SyntaxError([message[, fileName[, lineNumber]]]) Parameters message Optional. Human-readable description of the error fileName Optional. The name of the file containing the code that caused the exception lineNumber Optional. The line number of the code that caused the exception Properties SyntaxError.prototype Allows the addition of properties to a SyntaxError object. Methods The global SyntaxError contains no methods of its own, however, it does inherit some methods through the prototype chain. SyntaxError instances Properties SyntaxError.prototype.constructor Specifies the function that created an instance's prototype. SyntaxError.prototype.message Error message. Although ECMA-262 specifies that SyntaxError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. SyntaxError.prototype.name Error name. Inherited from Error. SyntaxError.prototype.fileName Path to file that raised this error. Inherited from Error. SyntaxError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. SyntaxError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. SyntaxError.prototype.stack Stack trace. Inherited from Error. Methods Although the SyntaxError prototype object does not contain any methods of its own, SyntaxError instances do inherit some methods through the prototype chain. Examples Catching a Sy
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this math error site About Us Learn more about Stack Overflow the company Business Learn more static semantic error about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x execution error Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up What is https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError causing the syntax error I see in Firefox developer console? up vote 0 down vote favorite Attached is a screenshot of the developer console. I see a syntax error in a closure definition. I've a JavaScript file, which has the following function. I'm loading the JavaScript file from another function and calling sampleFunction() from it. var sampleFuntion=function(obj){ //Statement here; }; But Firefox shows a syntax http://stackoverflow.com/questions/23904382/what-is-causing-the-syntax-error-i-see-in-firefox-developer-console error for the first line, which is the function declaration/definition. I'm using Mozilla Firefox 29.0.1 on Windows 7. What is the actual error in the code? javascript firefox firefox-developer-tools share|improve this question edited May 28 '14 at 20:31 Sebastian Zartner 7,27832956 asked May 28 '14 at 6:37 Rupam Datta 1,17611230 It's really hard to read the code in the screen shot. Can you post it as plain text? –Barmar May 28 '14 at 6:42 @Barmar Just edited. Please check now. –Rupam Datta May 28 '14 at 6:47 There is no syntax error, there... Are there any illegal characters around that function that aren't rendering? –Cerbrus May 28 '14 at 6:54 @Cerbrus Yes I also feel the same. There is no syntactical error. Also I rechecked for any illegal characters. –Rupam Datta May 28 '14 at 7:04 So, exactly what error is the console throwing? –Cerbrus May 28 '14 at 7:12 | show 1 more comment 3 Answers 3 active oldest votes up vote 2 down vote As the indicated script line doesn't contain any visual syntactical error, the problem is p
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss http://stackoverflow.com/questions/34624099/json-syntax-error-in-firefox-only the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping syntax error each other. Join them; it only takes a minute: Sign up JSON syntax error in firefox only up vote 0 down vote favorite Im getting a syntax error in FireFox when using $.parseJSON(). The same code works properly on Chrome/Chromium, and Safari. I call this function to get a random generated token to set. function getToken() { var firefox javascript syntax url = "/csrf_token_generate"; $.ajax({ url: url, method: "GET" }).done(function(data) { console.log(data); // Logs the data from the call var json = $.parseJSON(data); // Where the error occurs token = json.token; console.log(token); }); } The URL /csrf_token_genrate returns a JSON object similar to {"token":"$2y$10$jcr.P3FNqeji6RqD93LnxeIKs9gYNiPj7cboahz8RCCSgKw7VOfhi"} In the URL, I am setting the Content-Type to application/json which works in every other browser. The error Im getting is this SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data n.parseJSON() jquery.min.js:4 getToken/<() wheel.bak.js:94 n.Callbacks/j() jquery.min.js:2 n.Callbacks/k.fireWith() jquery.min.js:2 x() jquery.min.js:4 .send/b/<() jquery.min.js:4 The object that is being console.log()'ed is this Object { token: "$2y$10$60vxSZiVqushBLVHSR5jPO6MquD4…" } I just can't seem to track down why it won't work in only FireFox, but works fine in other browsers. UPDATE 1 I figured out that firefox was trying to parse an already parsed object, so I changed the code to be along this function getToken() { var url = "/csrf_token_generate"; $.ajax({ url: url, method: "GET" }).done(function(data) { var json = data; token = json.token; console.log(token); }); } Whi