zoukankan      html  css  js  c++  java
  • AJAX的最小单元

    $(function(){

        $('#send').click(function(){

             $.ajax({

                 type: "GET",

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

                          }

             });

        });

    });

  • 相关阅读:
    Leetcode Plus One
    Leetcode Swap Nodes in Pairs
    Leetcode Remove Nth Node From End of List
    leetcode Remove Duplicates from Sorted Array
    leetcode Remove Element
    leetcode Container With Most Water
    leetcode String to Integer (atoi)
    leetcode Palindrome Number
    leetcode Roman to Integer
    leetcode ZigZag Conversion
  • 原文地址:https://www.cnblogs.com/handongyu/p/5150824.html
Copyright © 2011-2022 走看看