Im trying to pass two JavaScript variables to PHP variables.
function myFunction(){
var one = 'one';
var two = 'two';
}
After doing my research, I have pretty much come to the conclusion I am going to have to use AJAX, something like
window.location.href = "myphpfile.php?one=" + one;
window.location.href = "myphpfile.php?two=" + two;
But Im having trouble picking up the variable in PHP using
$_GET['one']
$_GET['two']
Im also confused as to whether I am calling the php script twice. Is there a working way to pass two variables? I have found several ways to pass one but none to pass two.
window.location.href
is a browser redirection, not an AJAX call. Since you have tagged jquery-ajax, start reading here. – Michael Berkowski Jan 6 '13 at 15:19$.get('myphpfile.php?one=one&two=two'...)
, but there's more to it than that... – Michael Berkowski Jan 6 '13 at 15:19isset($_GET['one'])
and tell us what happens. – aug Jan 6 '13 at 15:22