• 2016/4/21 关于jquery复习


    jQuert AJAX 

    【1】jQuery load()方法 :是AJAX方法, 从服务器加载数据,并把数据放入被选元素中 语法:

    $(selector).load(URL,data,callback); 
    例1:$("#div1").load("demo_test.txt");【文件 "demo_test.txt" 的内容加载到指定的 <div> 元素中:】
    例2;$("#div1").load("demo_test.txt #p1");【"demo_test.txt" 文件中 id="p1" 的元素的内容,加载到指定的 <div> 元素中:】
    $("button").click(function(){
      $("#div1").load("demo_test.txt",function(responseTxt,statusTxt,xhr){
        if(statusTxt=="success")
    例3:   alert("外部内容加载成功!");
        if(statusTxt=="error")
          alert("Error: "+xhr.status+": "+xhr.statusText);
      });
    });
    • responseTxt - 包含调用成功时的结果内容
    • statusTXT - 包含调用的状态
    • xhr - 包含 XMLHttpRequest 对象
    •  load() 方法完成后显示一个提示框。如果 load() 方法已成功,则显示“外部内容加载成功!”,而如果失败,则显示错误消息:

    *******************************************************************************************************************

    get()和post()方法

    $.get() 方法通过 HTTP GET 请求从服务器上请求数据 ,

    语法:$.get(URL,callback);
    $("button").click(function(){
      $.get("demo_test.asp",function(data,status){
        alert("Data: " + data + "
    Status: " + status);
      });
    });

    $.post() 方法通过 HTTP POST 请求从服务器上请求数据。

    语法:$.post(URL,data,callback);
    很多事情不是看到希望才去坚持,而是坚持了才会看到希望
  • 相关阅读:
    TreeMap
    索引
    B-树、B+树
    硬盘速度、存储方式
    2-3树
    多叉树、2-3-4树
    红黑树
    平衡树、AVL树
    树、多路树、二叉树
    Java实现后缀表达式建立表达式树
  • 原文地址:https://www.cnblogs.com/isisbenben/p/5417294.html
Copyright © 2020-2023  润新知