Skip to content

Instantly share code, notes, and snippets.

@strongant
Created May 23, 2016 08:42
Show Gist options
  • Save strongant/77db44e84ec85f8077762a5848b9c2d6 to your computer and use it in GitHub Desktop.
Save strongant/77db44e84ec85f8077762a5848b9c2d6 to your computer and use it in GitHub Desktop.
jquery设置请求头并且发送
$.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