How can we have JavaScript variable value in PHP variable within the same page??
I have a JavaScript variable which have the JSON String and I want to store in PHP variable so that I can store it into database. Is it possible??
How can we have JavaScript variable value in PHP variable within the same page?? I have a JavaScript variable which have the JSON String and I want to store in PHP variable so that I can store it into database. Is it possible?? |
|||||||||||||
|
You should write a In javascript when you are ready to save the As explained in this answer Send JSON data from Javascript to PHP? or if its a form you can refer this answer to submit the serialised data with HTML form |
|||
|
Use jQuery. $.get('file.php?var='+variable); Then in PHP $_GET['var']; |
|||
|