var comments = $("#comments")
$.getJSON("server.php",function(json){
$.each(json,function(index,array){
var txt = "<p><strong>"+array["user"]+"</strong>:"+array["comment"]+"<span>"
+array["addtime"]+"</span></p>"
comments.append(txt)
})
})
$("#add").click(function(){
var user = $("#user").val()
var txt = $("#txt").val()
$.ajax({
type:'POST',
url:"comment.php",
data:"user="+user+"&txt="+txt,
success:function(msg){
if(msg==1){
var str = "<p><strong>"+user+"</strong>:"+txt+"<span>刚刚</span></p>"
comments.append(str)
$("#message").show().html("发表成功!").fadeOut(1000)
$("#txt").attr("value","")
}else{
$("#message").show().html(msg).fadeOut(2000)
}
}
})
})
})
<script type="text/javascript">$(document).ready(function() {
$("#select").click(function() {
var startdate = $("#startdate").datebox('getValue')
var endate = $("#enddate").datebox('getValue')
$.ajax({
type: "post",
dataType: "html",
url: "../Service/WebService.ashx?Method=GetMealCalendHtml",
data: { startDate: startdate, endDate: endate },
success: function(json) {
$("#calendaPanel").empty()
$("#calendaPanel").append(json)
}
})
})
})
function Oncheck(mealdata) {
$("#" + mealdata.id + " input[type=checkbox]").each(function() { console.log(this) })
}
</script>
<dl id="output"></dl><script>
$.ajax({
url:略,
success:function(res){
var html=""
res.article.forEach(function(e){
html+="<dt>"+e.title+"</dt>"
html+="<dd>"+e.content
if(e.images)e.images.forEach(ee){
html+="<img src='"+ee+"'/>"
}
html+="</dd>"
})
$("#output").append(html)
}
})
</script>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)