更新时间:2023-12-05 16:15:16
你可以试试这个:
$.ajax({
url: "test.html",
cache: false,
success: function(html){
$("#results").append(html);
}
});
在code将追加的test.html
文件到 #results
元素
找到更多的jQuery的网站: http://api.jquery.com/jQuery.ajax/
find more at jquery website: http://api.jquery.com/jQuery.ajax/
更新: 用它来发送POST数据,并输出结果
update: use this to send POST data and output result
var menuId = $("ul.nav").first().attr("id");
var request = $.ajax({
url: "script.php",
type: "POST",
data: {id : menuId},
dataType: "html"
});
request.done(function(msg) {
$("#log").html( msg );
});
request.fail(function(jqXHR, textStatus) {
alert( "Request failed: " + textStatus );
});