kobo1d
06-22-2012, 06:49 PM
hello there!
i was facing this problem whole day and i did not come up with a solution, so i ask you guys for help.
my code looks like this: (using jquery)
(more code here)
$.post("test.php", {encryptedPassword2: encryptedPassword}, function(data){
console.log(data); //DEBUG: print the result of this action to debug console
});
</script>
<?php
$rsapassword = $_POST['encryptedPassword2'];
print_r($_REQUEST); //DEBUG: print out all get/post
echo $rsapassword;
(more code here)
now when i load the page, above this code the script calculates "encryptedPassword" in javascript and in the same page load i want to transfer this variable, so my "$_POST['encryptedPassword2']" is set and can be used further on in the php script without the need of a page refresh...
in this above example the output of the page load is an error, since the variable isnt set when php calls for it. but in the console output of javascript "console.log(data);" the output looks right. over there the variables are set and print out. so the ajax response comes way later, when page is allready finished loading.
sorry im not really good in this, so i would appriciate any help!!
thx in advance
i was facing this problem whole day and i did not come up with a solution, so i ask you guys for help.
my code looks like this: (using jquery)
(more code here)
$.post("test.php", {encryptedPassword2: encryptedPassword}, function(data){
console.log(data); //DEBUG: print the result of this action to debug console
});
</script>
<?php
$rsapassword = $_POST['encryptedPassword2'];
print_r($_REQUEST); //DEBUG: print out all get/post
echo $rsapassword;
(more code here)
now when i load the page, above this code the script calculates "encryptedPassword" in javascript and in the same page load i want to transfer this variable, so my "$_POST['encryptedPassword2']" is set and can be used further on in the php script without the need of a page refresh...
in this above example the output of the page load is an error, since the variable isnt set when php calls for it. but in the console output of javascript "console.log(data);" the output looks right. over there the variables are set and print out. so the ajax response comes way later, when page is allready finished loading.
sorry im not really good in this, so i would appriciate any help!!
thx in advance