Skip to content

Instantly share code, notes, and snippets.

@chihirokaasan
Created March 13, 2018 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chihirokaasan/5109c009d076f6d7b2584625bdc782eb to your computer and use it in GitHub Desktop.
Save chihirokaasan/5109c009d076f6d7b2584625bdc782eb to your computer and use it in GitHub Desktop.
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