zoukankan      html  css  js  c++  java
  • 新版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 );
    });
  • 相关阅读:
    LeetCode 225. 用队列实现栈 做题笔记
    杨辉三角
    字母图形
    01字符串
    圆的面积
    饮料和啤酒
    进制转换
    从今天起 复习算法
    乘法群
    Paillier同态加密的介绍以及c++实现
  • 原文地址:https://www.cnblogs.com/jerrypro/p/6704031.html
Copyright © 2011-2022 走看看