我尝试使用 insertAfter() 将一些内容加载到表中,但我尝试加载的内容是我使用 AJAX.Load() 获取的 html(从 asp.net 页面输出) .
根据我的理解,insertAfter() 的工作方式如下:$("htmlcodehere").insertAfter("selector")。 AJAX.Load() 的工作方式如下:$("selector").load("Html/file")。我将如何合并这两个以便它加载 html(可能不将其添加到任何现有元素?)然后使用 insertAfter() 插入该数据?
巴拉
最佳答案
我试着用另一个答案更好地解释我:
$(document).ready(function(){ //If you want to load it immediately. Anyway, you execute this code after an event
$.get("file.html", //Make an ajax request to this file
function(data){ //data is the file.html content
$("table").append(data); //Or other operations like this to inject the html content into the table
})
})
关于asp.net - jQuery:使用 AJAX 加载外部页面,然后调用 insertAfter() 到表行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1347502/