Created
May 23, 2016 08:42
-
-
Save strongant/77db44e84ec85f8077762a5848b9c2d6 to your computer and use it in GitHub Desktop.
jquery设置请求头并且发送
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
accepts: { | |
"content-type": 'application/json' | |
}, | |
url: 'http://127.0.0.1:3000/todos', | |
type: 'post', | |
data: { | |
"data": response | |
}, | |
cache: false, | |
dataType: 'json' | |
}).done(function(data) { | |
console.log(data); | |
}).fail(function(jqXHR, textStatus) { | |
console.log('jqXHR:' + jqXHR); | |
console.log('textStatus:' + textStatus); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment