post数据以后页面没有刷新
发布于 11 年前 作者 ggaaooppeenngg 5068 次浏览 最后一次编辑是 8 年前
$.ajax({url:"http://127.0.0.1:3000/test",data:{"hello":"abc"}},function(d){alert(d)});
  });

我用ajax发一个data,然后用express这么写:

//.../routes.js
exports.test = function(req,res){
  console.log(req.query);
  res.send(200,'hello world:\n'+req.query);
}

在服务器端看到

{ hello: 'abc' }
GET /test?hello=abc 200 1ms - 28b

但是在客户端就没有 hello world出现 这是为什么

4 回复

jQuery API先搞懂

用ajax请求会发生什么

@thesadboy 当我问了一个白痴的问题吧…………

回到顶部