What is correct syntax for Jquery done()? [closed] - javascript

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have the following syntax:
And am receiving the following error on line 6:
Uncaught SyntaxError: Unexpected token {
I read the api docs on done() and I can't see what I am doing wrong here.

$.post(path).done(funtion(data) { ....
^----notice any missing characters here, a "c" perhaps?
JS is trying to call a function called "funtion", which means that the { afterwards is illegal syntax. Since it parses out that syntax error first, it doesn't get to the point of being to able to tell you that "funtion" doesn't exist.

You wrote funtion instead of function.
$.post(path).done(function(data) { console.log(data) });

Related

MongoError: collection name must be a String - Even though I specified a string already [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
Does anyone have any idea why I'm facing this error even though I've clearly specified 'user' as my collection which is a string? Thank you in advance! (Btw I'm tryna modularise all my database Handler into another js file).
The problem is in your module.exports, you're executing the function instead of passing a reference to the function. Try this:
module.exports = {
insertHandler: insertHandler
}
or using ES6
module.exports = {
insertHandler
}

javascript/jquery syntax differences, declaring new a variable [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
My code in javascript causes an error at the following line:
var tries:int=GetCallAttemptCount();
The error message says Error in Script Unexpected token : , Line 3
Line 3 is where the error appears. The script was originally in jquery, so I wonder is there a difference in how a variable is declared in Javascript and Jquery?
I'm computer literate, but I am a beginner with Javascript.
Thanks all, Adam
That's not javascript, this looks like typescript, in JS:
var tries = GetCallAttemptCount();

Javascript String.prototype unexpected token [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
Apologies if this has been asked before but I couldn't find this specific issue.
I've been tasked with analysing a bit of highly obfuscated, and malicious, JS code. I'm trying to get it to run in a VM at the minute just to see exactly what it's up to but I'm getting a syntax error on the first line.
function String.prototype.x(){...
From Chrome's dev console:
Uncaught SyntaxError: Unexpected token .
The red squiggly line shows that the error is being thrown at the first dot (between String and prototype). To be honest, I don't know enough about JS to figure it out but I'm sure one of you lovely lot will know the answer. Why's it thrown and what can I do to fix it?
String is already a class (function with the inbuilt prototype methods) in JS , in order to create methods in its prototype chain you have use as below
String.prototype.reverse = function(){
return this.split('').reverse().join()
}
"hello".reverse() // olleh

Getting error: Uncaught Syntax Error: Unexpected token [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I need to add class to all the links that have "href=login". And i tried to use this javascript
jQuery(document).ready(function($){
$(.pageWidth).find('a[href*="/login/"]').addClass('OverlayTrigger');})
Unfortunately, i tried so many times and it always getting this error
Uncaught Syntax Error: Unexpected token
How can i fix this? What's the problem here?
Thank you!
You are missing quotes in your jQuery selector:
jQuery(document).ready( function($) {
$('.pageWidth').find('a[href*="/login/"]').addClass('OverlayTrigger');
} )

Uncaught SyntaxError: missing after argument list [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
Below is the parsed html of button. Basically, it's inside the datagrid.
When I click on this button it gives me console error:
Uncaught SyntaxError: missing ) after argument list
<button onclick="myFunction(javed#gmail.com)">Click</button>
Here is the scripting for click event.
function myFunction(e) {
alert(e);
}
You need to pass the email as a string, otherwise, it will be parsed as javascript
<button onclick="myFunction('javed#gmail.com')">Click</button>
Note, not all parameters need to be strings. Passing a number, function, object,or variable without quotes is valid.
If you do not include quotes, thats what the parser will assume your trying to pass but will fail if the parameter is neither of those.

Categories