LoginSignup
1
3

More than 5 years have passed since last update.

jQueryでajax処理

Posted at

内容

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('メッセージの送受信に失敗しました。');
});

※オプションの詳細は下記リファレンス参照

リファレンス

■ajax
http://js.studio-kingdom.com/jquery/ajax/ajax

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3