我的问题是我在文档中包含了html功能所需的脚本。在我的ajax请求我想要放置在页面上的html块后,功能不起作用。因此,由于脚本是在ajax调用之前加载的,脚本无法知道页面中有一个新的数据块。
是否有办法重新加载ajax调用后的脚本?或者解决这个问题的最好方法是什么?
成功方法应该能帮助你
$.ajax({
type: "POST",
url: "anyUrlPhpPage.php",
data: $("#formId").serialize(), //serialize the form data
cache: false,
success: function(msgReturned){
$("#resultDisplay").html(msgReturned);
//display the message in the div with id resultDisplay
}
});