最終更新:2018-02-15 (木) 05:30:01 (2254d)  

$.ajax
Top / $.ajax

Perform an asynchronous HTTP (Ajax) request.

http://api.jquery.com/jQuery.ajax/

$.ajax({
  url: "test.html",
  context: document.body
}).done(function() {
  $( this ).addClass( "done" );
});

dataType

  • default: Intelligent Guess (xml, json, script, or html)
  • xml
  • html
  • script
  • json
  • jsonp
  • text

settings

  • successFunction( Anything data, String textStatus, jqXHR jqXHR )
    errorFunction( jqXHR jqXHR, String textStatus, String errorThrown )
    completeFunction( jqXHR jqXHR, String textStatus )after success and error callbacks are executed

textStatus

  • error"timeout", "error", "abort", and "parsererror"
    complete"success", "notmodified", "nocontent", "error", "timeout", "abort", or "parsererror"

戻り値

  • jqXHRオブジェクト (jQuery 1.5~)、XMLHTTPRequest?のスーパーセット

jqXHR

イベント

  • jqXHR.done?
  • jqXHR.fail?
  • jqXHR.always?
  • jqXHR.then?
  • jqXHR.complete?

メモ

  • jqXHR.success(), jqXHR.error?(), and jqXHR.complete?() callbacks are removed as of jQuery 3.0.
  • You can use jqXHR.done?(), jqXHR.fail?(), and jqXHR.always?() instead.

関連