Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. SyntaxError {stack: "SyntaxError: Unexpected token :↵ at eval (nativ…st:3000/javascripts/jquery-1.10.1.min.js:6:18626)", message: "Unexpected token :"}
  2.  
  3. app.post('/api/sav', function(req, res, next) {
  4. var result = {"status": "success"};
  5. res.send(JSON.stringify(result)) // this works
  6.  
  7. //res.type('json'); // this has no effect
  8. //res.type('application/json'); // this has no effect
  9. //res.send(result); // this fails but should work, no?
  10. //res.json(result); // this fails but should work, no?
  11. });
  12.  
  13. $.ajax({
  14. type: "POST",
  15. url: '/api/sav',
  16. data: content,
  17. success: function(data, textStatus, jqXhr) {
  18. console.log(data);
  19. },
  20. error: function(jqXHR, textStatus,errorThrown ) {
  21. console.log(textStatus);
  22. console.log(errorThrown);
  23. },
  24. dataType: 'json'
  25. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement