I really dont know why this isnt working!
<script src="js/jquery.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript">
function updateVAL()
{
var f = document.getElementById("nu");
var val=f.value;
alert(val); // it displays the value properly
$.post("getDATA.php", {id: val}); // I sent the variable with jquery
}
</script>
getDATA.php
$value=$_POST['id'];
echo $value;
and when I access getDATA.php to see if it was sent I get this:
Notice: Undefined index: id in C:\Users\dan…
why the variable ‘id’ isnt set ? why is isnt passed to the server ?
Any help would be appreciated 🙂
Cheers,
dan.
Parameters are being sent via ajax – so this
jsscript callsgetDATA.phpand$_POST['id']is “seen” there only at that time.And you are trying to access
getDATA.phpafter and send nopostorgetparameters by your briwser – so you don’t see this params there.You have to catch
echoby yourjsscript. Look at this demo: