2013年1月30日水曜日

開発環境

『初めてのJavaScript 第2版』(シェリー・パワーズ著(Shelley Powers著)、武舎 広幸+武舎 るみ訳、オライリー・ジャパン、2009年、ISBN978-4-87311-425-5) の14章(Ajaxの基礎(jQuery))練習問第14-2、3.を解いてみる。

その他参考書籍

14-2, 3.

コード(BBEdit)

$('#pre0').html('');
$('#d0').html('');
$('#pre0').text("通信開始\n");
$.ajax({
    url: 'http://mkamimura.com/kamimura_blog/',
      type: 'GET',
      dataType: 'html',
      complete: function(xhr, textStatus) {
        $('#pre0').append("通信終了\ntextStatus:" + textStatus + "\n");
      },
      success: function(data, textStatus, xhr) {
        $('#d0').append(data);
      },
      error: function(xhr, textStatus, errorThrown) {
        $('#pre0').append("データの取得失敗\n" +
        "textStatus: " + textStatus + ", errorThrown: " + errorThrown + "\n");
      }
});


0 コメント:

コメントを投稿