代码区项目交易流程

res.render not rendering view, returns html text


Calling into express/node thus:

jQuery.ajax({ url : url, type: "GET", data: {names : names}, success: function(data) { console.log("ajax post success"); }, error: function(jqXHR) { console.log(jqXHR.responseText + ' :: ' + jqXHR.statusText); } });

In express router.js:

app.get('/metrics/:title/:node/:metric', function(req,res) { console.log("received request " ); console.log(req.query.names); res.render('nltuning', { locals: { tdata : req.params.title, gdata : req.params.node, mdata : req.params.metric, ndata : req.query.names } } ); });

All console msgs are printing correctly, ajax success is printing. ajax shows html text in response.

and the view is not rendered. Same for POST, GET - why is it ?

if i type in the same url in a browser window, the view is rendered. any pointers appreciated.

Problem courtesy of: user1447121

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

点击收藏

LAST 使用webpack4提升180%编译速度 玩转 JavaScript 之数据类型 NEXT