Reputation: 934
This javascript produces an error:
missing ) after argument list
In firebug with the code:
<script type=\"text/javascript\">
function add( answer )
{
$.post('../page.php?cmd=view&id=3523',
{user_id: 3523, other_user_id: 2343}, function(d)
$(answer).after(\"<span>Done!</span>\").remove();
});
}
}
</script>
What am I doing wrong?
Upvotes: 7
Views: 39106
Reputation: 8481
Close post()
function. third string from bottom should be )
, not }
.
EDIT: sorry, should be like this:
<script type=\"text/javascript\">
function add( answer )
{
$.post('../page.php?cmd=view&id=3523', {user_id: 3523, other_user_id: 2343}, function(d) {
$(answer).after(\"<span>Done!</span>\").remove();
});
}
Upvotes: 4
Reputation: 663
function add( answer )
{
$.post('../page.php?cmd=view&id=3523',
{user_id: 3523, other_user_id: 2343},
function(d){
$(answer).after("<span>Done!</span>").remove()
});
};
Upvotes: 2
Reputation: 10981
Why are you escaping quotes? The problem is here :
$(answer).after(\"<span>Done!</span>\").remove();
change to
$(answer).after("<span>Done!</span>").remove();
or
$(answer).after('<span>Done!</span>').remove();
Also, you're missing a { after the post() function (probably you missed the right spot, since there's another in the wrong place), so the final output :
<script type=\"text/javascript\">
function add( answer )
{
$.post('../page.php?cmd=view&id=3523', {user_id: 3523, other_user_id: 2343}, function(d) {
$(answer).after("<span>Done!</span>").remove();
});
}
</script>
Upvotes: 2
Reputation: 129792
function d
misses an opening bracket, {
$(answer).after(
should not be escaped \"
, just a regular quote will do "
Upvotes: 9