开发者

Javascript function call causes error

开发者 https://www.devze.com 2022-12-25 01:48 出处:网络
I am trying to call a function \"makeQuery\" and it\'s not working, FireBug is telling me: missing ; before statement

I am trying to call a function "makeQuery" and it's not working, FireBug is telling me:

missing ; before statement

[Break on this error] makeQuery(this.id){\n

I don't quite understand where it wants me to put the ";"

$(".predicate").click(function () {
开发者_JAVA技巧    makeQuery(this.id){
    alert(this.id);
    }
});

function makeQuery(value){
    queryString = queryString+"val="+value+"&";
    variables = variables+1;
    alert(queryString);
    alert(variables);           
}


replace

makeQuery(this.id){
alert(this.id);
}

with

makeQuery(this.id);
alert(this.id);


You have an extra curly brackets at wrapping the alert which doesn't make sense:

makeQuery(this.id){\

Should be:

$(".predicate").click(function () { 
    makeQuery(this.id);
    alert(this.id);      
}); 

The makeQuery requires the ; since you are calling a function.

0

精彩评论

暂无评论...
验证码 换一张
取 消