• JQuery.Ajax


    Examples:
    // Example: 加载并执行一个 JS 文件。
    $.ajax({
       type: "GET",
       url: "test.js",
       dataType: "script"
     });

    // Example: 保存数据到服务器,成功时显示信息。 $.ajax({ type:
    "POST", url: "some.php", data: "name=John&location=Boston", success: function(msg){ alert( "Data Saved: " + msg ); } });

    // Example: 装入一个 HTML 网页最新版本。 $.ajax({ url:
    "test.html", cache: false, success: function(html){ $("#results").append(html); } });

    // Example: 同步加载数据。发送请求时锁住浏览器。需要锁定用户交互操作时使用同步方式。
    var html = $.ajax({ url: "some.php", async: false }).responseText;

    // Example: 发送 XML 数据至服务器。设置 processData 选项为
    false,防止自动转换数据格式。 var xmlDocument = [create xml document]; $.ajax({ url: "page.php", processData: false, data: xmlDocument, success: handleResponse });

    // Example: 作为发送数据到服务器的ID,保存一些数据到服务器,并通知用户一旦它的完成。请注意,此用法
    - 返回到一个变量的调用的结果 - 需要同步(阻塞)的要求! (异步:假) bodyContent = $.ajax({ url: "script.php", global: false, type: "POST", data: ({id : this.getAttribute('id')}), dataType: "html", async:false, success: function(msg){ alert(msg); } } ).responseText;
  • 相关阅读:
    kafka
    yum-nginx
    expect
    ubuntu快捷方式
    10,zzlian爬取
    9-豆瓣电影
    8selenium
    7,pyquery获取数据
    6,BeautifulSoup-获取数据
    5-正则匹配获取数据
  • 原文地址:https://www.cnblogs.com/iwenr/p/3794923.html
Copyright © 2020-2023  润新知