我有一個代碼,其中的錯誤我返回一個錯誤信息狀態的字符串:的NodeJS:輸出使用快遞EJS模板
if (err){
res.render('page1', {status:2, msg:'Server Error : Probable unable to connect'});
return;
}
在我page1.ejs,我已經編寫方式如下:
var status = <%= status %>;
alert ('The status = ' + status);
if(status == 2)
{
var msg = "'" + <%= msg %> + "'";
alert(msg);
}
OR
if(status == 2)
{
alert('"' + <%= msg %> + "'");
}
我想獲得的地位和味精的價值 - 但因爲「味精」存在多重的話我一個m無法找到從NodeJS傳遞的捕獲完整字符串的方法。 Firebug的顯示錯誤爲:
語法錯誤:缺少)後的參數列表
alert('"' + Server Error : Probable unable to connect+ "'");
-------------------|
它涉及到同樣的錯誤任何一種方式:警報(服務器錯誤:可能無法連接); – Prakash