Jump to content

passing php variables to ajax script.


gamesmstr

Recommended Posts

I am using a button with an onclick parameter to launch a AJAX JS function and passing some php variables, but I need help with the formatting.  The 2 variables are $playerinfo[id] and $questrecord[uy].

 

<input type="button" value="North" onclick="playermove('north',playerinfo[id],questrecord[uy])">

Link to comment
https://forums.phpfreaks.com/topic/133197-passing-php-variables-to-ajax-script/
Share on other sites

If you're saying php outputs that button.. then it would be:

 

<?php
  echo "<input type='button' value='North' onclick=\"playermove('north','$playerinfo[id]','$questrecord[uy]')\" />";
?>

I think.. you might have to concat the php vars if it doesn't read the array indexes properly.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.