shootinstr8
asked on
I'm recieving "missing ) after argument list" using the following code
Why do I get "missing ) after argument list"
I'm using a php script to poputlate the href attribute.
what am I doing wrong?
thanks!
I'm using a php script to poputlate the href attribute.
what am I doing wrong?
thanks!
<-PHP script cut ->
echo "<a id='".$cat['projNum']."' class='detaillink' href='javascript:doAJAX(projDetails.php,".$cat['projNum'].",detailUpdate,get,0);' >".$cat['projNum']." ".$cat['Name']."</a>";
<- Results in ->
<a id='0005024.00' class='detaillink' href='javascript:doAJAX(proDetails.php,0005024.00,detailsUpdate,get,0);' >some project name</a>
javascript complains:
ERROR: missing ) after argument
doAJAX(projDetails.php,0005024.00,detailsUpdate,get,0);
error-------------------------^
ASKER
Thanks adrian,
I've tried both. When I put the quotes in I get
Error: Syntax error
doAJAX(projDetails.php,
error--------------------- -^
It trucates it at the single quote.
I've tried both. When I put the quotes in I get
Error: Syntax error
doAJAX(projDetails.php,
error---------------------
It trucates it at the single quote.
Try wrapping the projDetails.php in single quotes also. Because my guess is that the doAJAX function is expecting the string of what file to call for the RPC functionality.
So, try changing the projDetails.php to 'projDetails.php'.
So, try changing the projDetails.php to 'projDetails.php'.
ASKER
Thanks again adrian,
When I put the quotes in for the first param I get
Error: Syntax error
doAJAX(
error-----^
It trucates it at the single quote
When I put the quotes in for the first param I get
Error: Syntax error
doAJAX(
error-----^
It trucates it at the single quote
OH!!!
in your HTML...chance all your single quotes to double quotes...that's your problem. :P
Your single quotes are confusing the line terminations...hehehe
in your HTML...chance all your single quotes to double quotes...that's your problem. :P
Your single quotes are confusing the line terminations...hehehe
echo "<a id=\"".$cat['projNum']."\" class=\"detaillink\" href=\"javascript:doAJAX(' projDetail s.php','". $cat['proj Num']."',' detailUpda te','get', 0);\" >".$cat['projNum']." ".$cat['Name']."</a>";
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks ALL! I new to Javascript/php and i couldn't have figured this out by myself! I'm awarding 200 points to adrian for helping get on track and for spending the time to help me. However I'm awarding hielo 300 points because his was the final solution I ended up using. hielo, could you point me where I can learn about the syntax you used? I've never seen the braces in place of escaping quotes before, Or maybe just a quick explanation?
>> I've never seen the braces in place of escaping quotes before
In php if you have:
$greeting = "hello";
you can do this:
echo $greeting;
OR this:
echo "$greeting";
OR this:
echo "{$greeting}";
Notice that beginning and ending characters are double quotes, not apostrophes.
I used it so that is easier to "maintain", but NOT really necessary. The real "solution" I provided was in the javascript statement. If you notice all but one of the parameters are quoted. That was necessary actually.
In php if you have:
$greeting = "hello";
you can do this:
echo $greeting;
OR this:
echo "$greeting";
OR this:
echo "{$greeting}";
Notice that beginning and ending characters are double quotes, not apostrophes.
I used it so that is easier to "maintain", but NOT really necessary. The real "solution" I provided was in the javascript statement. If you notice all but one of the parameters are quoted. That was necessary actually.
ERROR: missing ) after argument
doAJAX(projDetails.php,000
error---------------------
^-----because perhaps this should be a string, like this '0005024.00' instead of a float, which it's zeros would have also been truncated as there are no leading zeros in real numbers.