zoukankan      html  css  js  c++  java
  • ajax相关用法

    案例代码:

    $(function(){
      $('#send').click(function(){
        $.ajax({
          type: "GET",//请求类型GET、POST
          url: "test.json",//请求地址
          data: {username:$("#username").val(), content:$("#content").val()},
          dataType: "json",
          success: function(data){
            $('#resText').empty(); //清空resText里面的所有内容
            var html = '';
            $.each(data, function(commentIndex, comment){
            html += '<div class="comment"><h6>' + comment['username']
            + ':</h6><p class="para"' + comment['content']
            + '</p></div>';
            });
            $('#resText').html(html);
          },
          error:function(e){
            alert(e);
           }
        });
      });
    });

  • 相关阅读:
    CSP-S2019游记
    BZOJ4668 冷战
    [ZJOI2007]仓库建设
    CF833B The Bakery
    决策单调性优化DP+分治优化决策单调性
    穿越栅栏 Overfencing
    控制公司 Controlling Companies
    派对灯 Party Lamps
    CSP2019总结
    差分约束
  • 原文地址:https://www.cnblogs.com/hpp0716/p/6586450.html
Copyright © 2011-2022 走看看