• 新版jquery的ajax调用 , jquery1.5以上


    原文出处:http://api.jquery.com/jQuery.ajax/,该链接页面底部有代码展示

    示例1:

    $.ajax({
      method: "POST",
      url: "some.php",
      data: { name: "John", location: "Boston" }
    })
      .done(function( msg ) {
        alert( "Data Saved: " + msg );
      });

    示例2:

    var xmlDocument = [create xml document];
    var xmlRequest = $.ajax({
      url: "page.php",
      processData: false,
      data: xmlDocument
    });
     
    xmlRequest.done( handleResponse );

    示例3:

    var menuId = $( "ul.nav" ).first().attr( "id" );
    var request = $.ajax({
      url: "script.php",
      method: "POST",
      data: { id : menuId },
      dataType: "html"
    });
     
    request.done(function( msg ) {
      $( "#log" ).html( msg );
    });
     
    request.fail(function( jqXHR, textStatus ) {
      alert( "Request failed: " + textStatus );
    });
  • 相关阅读:
    日报10.29
    日报10.28
    日报10.27
    周进度总结-6
    日报10.25
    日报10.23
    日报10.22
    日报10.21
    日报10.18
    STL bitset
  • 原文地址:https://www.cnblogs.com/jerrypro/p/6704031.html
Copyright © 2020-2023  润新知