javascript - Sails.js - How to render a partial from a controller? -


i have partial view containing login form. render ajax call controller.

this sample return partial view:

postlogin: function (req,res) {      var username = req.param('username');     var password = req.param('password');      user.find({         username: username,         password: password.salt()     }).done(function(err, users){         if(users.length == 1){             // here want return partial view, not view             res.view('home/login', {message: 'login success!'});         }else{             // here want return partial view, not view             res.view('home/login', {message: 'login failed!'});         }     });   }, 

ah! found it!

if view partial view, specify layout: null:

res.view('home/login', {message: 'login failed!', layout: null}); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -