内容
jQueryでサーバーとアクセスする場合に使うajaxのメモ。
以下は指定URLにdata[id,key]をpostして、dataType[text型]の戻り値のサンプルとなります。
処理
$.ajax()
$.ajax({
type: "POST",
url: "https://hoge.hoge@hoge.hoge",
data: {
"id": "hoge",
"key": "key"
},
dataType: "text"
}).done(function(msg){
alert('メッセージの送受信に成功しました。' + msg);
}).fail(function(data){
alert('メッセージの送受信に失敗しました。');
});
※オプションの詳細は下記リファレンス参照