我想将数据作为POST而不是GET传递 如何通过POST方法更改此行代码以传递表单?
var data = form.serialize();
<html>
<head>
<title> Form</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script>
jQuery(document).ready(function(){
jQuery("#itm_form").submit(function(evento){
evento.preventDefault();
var form = jQuery(this);
// When using an object/map (key/value pairs), the request is made as a POST.
var data = form.serialize();
jQuery('#destino').load("recibe-parametros3.php", data, function(){ // load(url, data, complete);
alert("recibidos los datos por ajax");
});
});
})
</script>
</head>
<body>
<form id="itm_form" >
Nombre: <input type="text" name="itm_name">
Email: <input type="text" name="itm_email">
<input type="submit" value="Enviar">
<input type="hidden" name="itm_oculto" value="0">
</form>
<div id="destino"></div>
</body>
</html>