SHARE
TWEET

ExpressJs

Dprogrammed1 May 24th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top