$.ajax({type:'POST',url:'example.php',// PHP 服务端的地址data:{name:'John',age:30},// ...
$.ajax({url:"http://example.com/data",dataType:"jsonp",success:function(data){console.log(data);}}); 在PHP服务器端设置CORS响应头,允许跨域请求。 代码语言:php 复制 header("Access-Control-Allow-Origin: *");header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE");header("Access-...
jQuery 1.5 中的约定接口同样允许 jQuery 的 Ajax 方法,包括 $.post(),来链接同一请求的多个 .success()、.complete() 以及 .error() 回调函数,甚至会在请求也许已经完成后分配这些回调函数。 // 请求生成后立即分配处理程序,请记住该请求针对 jqxhr 对象 var jqxhr = $.post("example.php", function() {...
jQuery 1.5 中的约定接口同样允许 jQuery 的 Ajax 方法,包括 $.post(),来链接同一请求的多个 .success()、.complete() 以及 .error() 回调函数,甚至会在请求也许已经完成后分配这些回调函数。 // 请求生成后立即分配处理程序,请记住该请求针对 jqxhr 对象 var jqxhr = $.post("example.php", function() { ...
jQuery 1.5 中的约定接口同样允许 jQuery 的 Ajax 方法,包括 $.post(),来链接同一请求的多个 .success()、.complete() 以及 .error() 回调函数,甚至会在请求也许已经完成后分配这些回调函数。 // 请求生成后立即分配处理程序,请记住该请求针对 jqxhr 对象var jqxhr = $.post("example.php", function() { ...
jQuery.ajax({ url: "handler.php", data: "appetizer=" + $("#appetizer").val() + "&entree=" + $("#entree").val() + "&dessert=" + $("#dessert").val(), type: "POST", success: function(data) { $("#form_content").html(data); ...
$.post("test.php", {name:"John",time:"2pm"} ); Example 3 Pass arrays of data to the server (while still ignoring the return results). 1 $.post("test.php", {'choices[]': ["Jon","Susan"] } ); Example 4 Send form data using Ajax requests ...
http://www.formget.com/jquery-post-data/ jQuery Ajax Post Data Example Fugo Of FormGet jQuery $.post() method is used to request data from a webpage and to display the returned result (sent from requested page) on to that webpage from where the request has been sent without page refr...
$.post("test.php", { "func": "getNameAndTime" }, function(data){ alert(data.name); // John console.log(data.time); // 2pm }, "json"); 9描述: jQuery 1.12 中 jQuery.post支持对象参数,具体的参数可以参考$.ajax(): jQuery 代码: ...
Example:使用Ajax请求发送表单数据。 1 $.post("test.php", $("#testform").serialize()); Example:Alert 从 test.php请求的数据结果 (HTML 或者 XML,取决于返回的结果)。 1 2 3 $.post("test.php",function(data) { alert("Data Loaded: "+ data); ...