Monday, November 12, 2012

php – missing ) after argument list

I\’ll show the main parts of the code as most of it is irrelevant:



$url = $row[\'url\'];
echo \"<div id=\'anything\'><img id=\'$url\' src=\'$cover\' alt=\'$title\' onclick=\'myFunction($url)\'>\";


and the javascript function:



function myFunction(something) {
alert (something);
}


I recieve the following error in firebug:



missing ) after argument list
[Break On This Error]
myFunction(http://anything.com/anything...
-------------------^


I am relatively new to javascript but I can tell it is obviously not allowing the \”:\” from the url. However, I can\’t change or alter the id, as I need to alert the exact id of the Image.


I have made this work in a different format without the php, so I assume it\’s there where the problem lies?






Rating: 3 out of 5 based on 4 ratings



The post php – missing ) after argument list appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/php-missing-after-argument-list.html

No comments:

Post a Comment