Getting value from JS to PHP [duplicate]
Possible Duplicate:
How to pass value from Javascript to PHP and get return of PHP back to Javascript
how to get value from
JS:
var vars="";
and add it into PHP
$vars="";
Vars
contains onl开发者_如何学编程y digits.
You'll have to send that variable with ajax or another kind of request to your server.
For example:
(JS):
var vars="123";
$.get('get_that_Variable.php?vars='+vars);
(PHP):
<?php
$vars = $_GET['vars'];
Its impossible for us to pass JS variable values to PHP variables cause PHP is a server side language and JavaScript is client side. Please understand that when your browser is running the JS codes PHP has already completed executing.
The only way that you will be able to do this is using AJAX. But thats a different story altogether.
精彩评论