Click here to Skip to main content
15,913,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Transfer the contents of a JavaScript variable to a php variable?
Posted

Sounds like you are talking of sending content from client to server.
Use XMLHttpRequest[^] for it.
 
Share this answer
 
few solution is available. but the simplest one would be as below example:
C++
function forward()
{
 var a=100;
 var b=200;
 document.location="target_php_file.php?a="+a+"&b="+b;
}


now, call this so called function.

and in php use $_GET array to access the data.

as i told you can also do other trick to send the data. you can send as AJAX request as Sandeep Mewara says, you can also create hidden form with hidden object and then commit submit function on the form. well pick your solution
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900