Pin*_*kie 1 javascript php ajax jquery post
我究竟做错了什么.PHP似乎没有赶上title并wrapper从$阿贾克斯.代码看起来是否正确.我得到的成功消息表明找不到标题的错误.
jQuery main.html
$.ajax({
type: "POST",
url: "process.php",
data: 'title=test&wrapper=testing',
success: function(msg){
alert( "Data Saved: " + msg );
}
});
Run Code Online (Sandbox Code Playgroud)
PHP process.php
<?php
$title = $_REQUEST['title'];
$wrapper = $_REQUEST['wrapper'];
...
?>
Run Code Online (Sandbox Code Playgroud)
看一下:jQuery.ajax()
数据参数最好是一个键/值对对象,它更干净,更容易调试:)
$.ajax({
type: "POST",
url: "process.php",
data: {
title: 'test',
wrapper: 'testing'
},
success: function(msg){
alert( "Data Saved: " + msg );
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7345 次 |
| 最近记录: |