Reputation: 285
I have the following php code.
$msg .='<a href="#dialog" name="modal" class="icons reply_icon" onclick="reply('.$messages_row["sender_id"].','.$messages_row['sender_email'].')"><span>reply</span></a>';
When I click this anchor tag, I get the following error in console.
SyntaxError: illegal character @ in [email protected]
I know the problem is due to single double quotes but don't know how to put the correct quotes.Can anyone help me please.
Upvotes: 0
Views: 91
Reputation:
You can use backslash to use quotes as part of string
And in javascript, when passing str data to function it need to be in quotes.
$msg .='<a href="#dialog" name="modal" class="icons reply_icon" onclick="reply(\''.$messages_row["sender_id"].'\',\''.$messages_row['sender_email'].'\')"><span>reply</span></a>';
Upvotes: 6