Advertisement
Dprogrammed1

ExpressJs

May 24th, 2019
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. $.post("/process", {name:'john'}, function(data){
  2. // Do some stuff
  3. });
  4.  
  5.  
  6. Code:
  7. app.post('/process', function(req, res){
  8. var data = '';
  9.  
  10. if(req.xhr){
  11. data += 'One';
  12. }
  13.  
  14. if(req.body.name){
  15. data += 'Two';
  16. }
  17.  
  18. res.send(data);
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement