当我点击提交按钮时,我希望将所有表单数据POST到process.php。然后在process.php中,我想要回显POST数据,并最终将结果div中的所有内容替换为在process.php中所做的事情。
<script type="text/javascript">
$(document).ready(function(){
$("#myform").submit( function () {
$.ajax({
type: "POST",
dataType: "html",
cache: false,
url: "process.php",
success: function(data){
$("#results").html(data);
}
});
return false;
});
//$("#myform").submit( function () {
//$('#results').html("yay");
//}
// });
//} );
});
</script>
<form name="myform" id="myform" action="" method="POST">
<!-- The Name form field -->
<label for="name" id="name_label">zoom</label>
<input type="text" name="zoom" id="zoom" size="30" value=""/>
<br>
</select>
<!-- The Submit button -->
<input type="submit" name="submit" value="Submit">
</form>
<!-- FORM END ---------------------------------------- -->
<!-- RESULTS START ---------------------------------------- -->
<div id="results">nooooooo<?PHP $_SESSION[''] ?><div>
<!-- <input type="image" name="mapcoords" border="0" src="mapgen.php"> ---- -->
<!-- RESULTS END ---------------------------------------- -->