dop*_*ner 5 javascript json node.js
我有一个测试JSON对象如下
{ Id: 100, plugins: [{ Name: 'Test', Version: '2' }] }
Run Code Online (Sandbox Code Playgroud)
我用它创建的
var json = {};
json.Id = 100;
var plugins = [];
json.plugins = plugins;
json.plugins.push({"Name" : "Test", "Version" : "2"});
Run Code Online (Sandbox Code Playgroud)
我有一个客户端函数发出如下的AJAX发布请求
function postJSON() {
$.ajax({
type: 'POST',
url: 'features',
data: json,
dataType: 'json'
});
}
Run Code Online (Sandbox Code Playgroud)
我试图通过console.log(req)现在只是输入来阅读我的服务器上的这些信息,但它似乎没有得到我的json对象.
app.post("/features", function(req, res) {
console.log(req);
})
Run Code Online (Sandbox Code Playgroud)
感谢帮助!
| 归档时间: |
|
| 查看次数: |
1718 次 |
| 最近记录: |