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