zoukankan      html  css  js  c++  java
  • jQuery AJAX 与 jQuery 事件

    jQuery 本身即是为事件处理而特别设计的,jQuery 事件处理方法是 jQuery 中的核心函数。

    • $(function() { ... }); 是如下格式的缩写:

      $(document).ready(function() { ... });

    0. $ 符号

    • 根据类别,定位标签:

      <button>click me</button>
      <p>hide me</p>
      <p>hide me 2</p>
      
      $('button').click(function(){
          $('p').hide();          // 作用在两个 <p>/</p> 上
      });
    • 根据 id 定位标签:

      <h2 id='temp'></p>
      
      $('#temp').html(...);

    1. demo:点击按钮,将段落折叠

    $(document).ready(function () {
        $('button').click(function(){
            $('p').hide();
        });
    });

    2. jQuery ajax - getJSON() 方法

    • 使用 AJAX 请求来获得 JSON 数据,并输出结果:

      $("button").click(function(){
        $.getJSON("demo_ajax_json.js",function(result){
          $.each(result, function(i, field){                // 遍历数组
            $("div").append(field + " ");
          });
        });
      });
  • 相关阅读:
    控件显示和隐藏
    删除标题和边框
    界面图片
    VC界面最前端显示
    在VC++6.0开发中实现全屏显示
    VC比例放大缩小
    plsql dev
    通过OCCI连接oracle(C++)
    VC++使用Pro*CC++
    文件对话框
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9421021.html
Copyright © 2011-2022 走看看