0
0

More than 3 years have passed since last update.

Ajaxを簡単に実装するための覚え書き

Posted at

Ajaxで何か送信するときのための覚え書き

var req = new XMLHttpRequest();
req.onreadystatechange = function() {
    if (req.readyState == 4) { // 通信の完了時
    if (req.status == 200) {
        // 通信の成功時
    }
    }else{
        // 通信中の処理
    }
}
req.open('POST', '送信先URL', true);
req.setRequestHeader('content-type','application/x-www-form-urlencoded;charset=UTF-8');
req.send('hoge=&example='); 
0
0
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
0
0