Rectangle 27 0

javascript How do I send a variable value from php to jquery?


<script type="text/javascript">

function vediticket(ID){
  $.ajax({
            type: "POST",
            url: "inc.miapagina.inc.php",
            data: "idric=" + <?php echo $idrichiesta;?>,
vediticket(<?php echo $idrichiesta;?>);

hum correction sorry... obviously the php echo should be in the function call, not the function definition of the inconvenience of doing two things at once: so keep your original code and when you call the function do:

your code is not very clear: you seem to have put everything inside a php print call? That's not a very good idea. Instead only open the <\?php tag when you really need dynamic content from the server. To answer your specific question, all you need to do is echo or print your php variable, just like you would when dynamically creating an html id for instance from a php variable:

Note