Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SyntaxError {stack: "SyntaxError: Unexpected token :↵ at eval (nativ…st:3000/javascripts/jquery-1.10.1.min.js:6:18626)", message: "Unexpected token :"}
- app.post('/api/sav', function(req, res, next) {
- var result = {"status": "success"};
- res.send(JSON.stringify(result)) // this works
- //res.type('json'); // this has no effect
- //res.type('application/json'); // this has no effect
- //res.send(result); // this fails but should work, no?
- //res.json(result); // this fails but should work, no?
- });
- $.ajax({
- type: "POST",
- url: '/api/sav',
- data: content,
- success: function(data, textStatus, jqXhr) {
- console.log(data);
- },
- error: function(jqXHR, textStatus,errorThrown ) {
- console.log(textStatus);
- console.log(errorThrown);
- },
- dataType: 'json'
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement