0

hi,

i have passed following parameters in ajax function, onclick = "agU(<?php echo $u . ' , ' . $msg; ?>);" its not working. when i test the same function in following way it runs fine. onclick = "agU(<?php echo $u; ?>);" am i commiting any mistake in supplying variable???
please help..

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by diafol
0

hi,

i have passed following parameters in ajax function, onclick = "agU(<?php echo $u . ' , ' . $msg; ?>);" its not working. when i test the same function in following way it runs fine. onclick = "agU(<?php echo $u; ?>);" am i commiting any mistake in supplying variable???
please help..

You need to 'quote' your vars: onclick = "agU('<?=$u;?>','<?=$msg;?>');" I've used 'short tags' above - which is frowned upon [PLEEZE no more self-righteous 'I disagrees'!! IDGAD], but you can swap these for the full <?php echo $u;?> and <?php echo $msg;?> if you want.

You could also build a complete parameter string in pHp first (including quote marks) and then just include the php string - without encompassing quote marks.

From what I can see, your problem was quote marks - or should I say, the lack of them.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.