• 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);
           }
        });
      });
    });

  • 相关阅读:
    java_JDBC(3)
    java_JDBC(2)
    java_JDBC(1)
    seq语句随笔
    bzoj3159: 决战
    bzoj3905: Square
    bzoj3864: Hero meet devil
    有上下界的网络流问题
    uva12538
    bzoj3280: 小R的烦恼
  • 原文地址:https://www.cnblogs.com/hpp0716/p/6586450.html
Copyright © 2020-2023  润新知