...

View Full Version : jquery form submission help



phantom007
07-01-2008, 11: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

shyam
07-01-2008, 07:02 PM
<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>

you are sending the request twice and not sending the value for the request that mattters...

try


$("#quote").load("load.php", { tname: "John", ttime: "2pm" });



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum