Created
March 13, 2018 03:33
-
-
Save chihirokaasan/5109c009d076f6d7b2584625bdc782eb to your computer and use it in GitHub Desktop.
jQueryのAjax postのサンプル
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
$('#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