Hello everyone, I am currently creating a small JS app. that will help me search PostgreSQL and print related data via PHP. I am using jQuery to help me but I have this small problem. I wanted to test if the code worked, by prompting the PHP file to print a random text before moving on to data but I had this error in Firebug -nothing is printed as an output-:
"Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
[Break on this error] $.post('file.php', {name: form.name.value },"
my javascript and php code are below:
JAVASCRIPT
<head>
<style type="text/css">
#age{
display: none;
line-height: 0px;
font-size: 20px;
}
</style>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript">
function get(){
$.post('file.php', {name: form.name.value },
function(output) {
$('#date').html(output).show();
});
}
</script>
</head>
<body>
<p>
<form name="form">
<input type="text" name="name"><input type="button" value="Get" onClick="get();">
</form>
<div id="date"</div>
</p>
</body>
</html>
PHP
<?php
echo "a random sentence";
Any ideas about the problem ? Thanks.
?>