【JavaScript&jQuery】$.ajax()
2024-10-08 16:39:52
$(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);
}
});
});
});
最新文章
- WCF学习之旅—TcpTrace工具(二十五)
- [转][Starling] 神器——原生Swf一键导出到Starling!
- java8--stream
- ArrayList常用方法
- HttpRequest 和HttpWebRequest的区别
- vs2013中国集
- Asp.net开发常用的51个非常实用的代码
- hash_map和map的区别
- erlang nif小结
- PatrolRobot(UVa1600)BFS
- c++模板两个数的加法
- Learning Ionic中文版本
- C语言程序设计第一作业
- 图解TCP/IP
- oldboy s21day11
- 启动tomcat出现内存溢出错误 java.lang.OutOfMemoryError: PermGen space
- Docker入门02——Dockerfile详解
- MySQL 插件CONNECTION_CONTROL和CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS
- 【转】Android实战技巧之四十九:Usb通信之USB Host
- PHP文件锁定写入实例分享