Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jQueryのAjax postのサンプル
$('#selector').on('click',function(){
$.ajax({
url:'post/hogehoge',
type:'POST',
data:{
'data1': 'hogehoge',
'data2': ''hogehoge,
}
})
.done(function(data){
//成功した時にdataに何か入ってくる
console.log(data);
})
.fail(function(data){
//失敗した時 にdataに何か入ってくる
console.log(data);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment