1˚ - 客户端:+的NodeJS + ExpressJS玉+后没有呈现
$.ajax({
type: 'POST',
data: data,
url: '/someposturl',
success: function (data) {
console.log('success');
// $('body').html(data); // i don't want it, but if not so, nothing happens (render)
}
});
2˚ - 服务器:
app.get('/criptografar', function (req, res) {
console.log(req.something);
res.render('somepage', {
somevar: withsomevalue
});
//-I want this to work like a normal post
});
3˚ - 客户端 - > 'SomePage的' - 没有这个未呈现在客户端:
$('body').html(data); // i don't want it, but if not so, nothing happens (render)
或本
$('html').html(data); // i don't want it, but if not so, nothing happens (render) <- Jade Layout error.
而应该发生什么?您正在进行ajax调用,并且您可以清楚地看到服务器响应数据。你知道ajax是什么吗? :)如果你想让它像普通的POST一样工作,你可以例如从服务器返回URL并执行'location.href = url;'。 – freakish 2012-03-20 15:27:57
下次请正确格式化您的代码;而其他人很可能会很快做到这一点,让他们做一些你可以轻松做到的事情也不好。 – ThiefMaster 2012-03-20 23:46:59
你应该使用** app.post(**代替app.get( – 2012-10-15 07:18:41