让我说我有这个html dom
<body>
<div id="divId">
<span>John,</span>
<span>Karl,</span>
<span>Brandon,</span>
<span>Sam</span>
</div>
我想在最后一个孩子之后 加载一个跨栏儿童 ,我想要这样的事情
$("#divId span:last-child").after().load('http://localhost/testing/getter.php');
如何使用加载功能后使用它
由于
答案 0 :(得分:1)
您可以使用$.ajax
:
$.ajax({
url: 'http://localhost/testing/getter.php',
context: $('#divId')
}).done(function(data) {
this.append(data);
});
答案 1 :(得分:0)
尝试以下方法:
$('<span>').load('http://localhost/testing/getter.php').insertAfter("#divId span:last-child");