cancer10
07-01-2008, 10:46 AM
Hi,
I am trying to run a simple jQuery script that would load a php page "load.php" on click of a submit button and the load.php page would return the value of "tname" variable which is "John" in this case.
Following is my jQuery script.
<script src="jquery-1.2.6.js"></script>
<script>
$(document).ready(function(){
$("form#myform").submit(function() {
$.get("load.php", { tname: "John", ttime: "2pm" });
$("#quote").load("load.php");
return false;
});
});
</script>
<div id="quote"></div>
<form method="post" id="myform">
<input name="submit" type="submit" value="Submit" />
</form>
load.php page script
<?php
echo $_GET['tname'];
?>
However, the above does not work.
Can you help me plz?
Thanx
I am trying to run a simple jQuery script that would load a php page "load.php" on click of a submit button and the load.php page would return the value of "tname" variable which is "John" in this case.
Following is my jQuery script.
<script src="jquery-1.2.6.js"></script>
<script>
$(document).ready(function(){
$("form#myform").submit(function() {
$.get("load.php", { tname: "John", ttime: "2pm" });
$("#quote").load("load.php");
return false;
});
});
</script>
<div id="quote"></div>
<form method="post" id="myform">
<input name="submit" type="submit" value="Submit" />
</form>
load.php page script
<?php
echo $_GET['tname'];
?>
However, the above does not work.
Can you help me plz?
Thanx