$.ajax({
url: url,
dataType: 'text',
data:{
code : objcode,
},
success: function(data,textStatus, jqXHR){
//能近来就说明成功了 直接alert(‘已赞过’)就行了
$("#data1").html(data)
$.parser.parse($("#data1"))
},
error: function(){
alert("失败!")
},
async: false
})
可以直接load()到div里,或ajax({
url:文件路径,
success:function(res){
//把res当内容付给div
div.html(res)
}
})
$(document).ready(function(){$("#b01").click(function(){
htmlobj=$.ajax({url:"csdaizuo.com",async:false})
$("#myDiv").html(htmlobj.responseText)
})
})
像这样,页面在不加载的情况下就可以获取数据,这就是ajax,所以您不需要考虑页面重新加载的情况,
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)