Jquery 将html输出附加到其他div
我有两个divJquery 将html输出附加到其他div,jquery,appendto,Jquery,Appendto,我有两个div <div id="ResultsId"> Here are the results from the session!<br> </div> 你好像打错了什么东西。试试这个: $("#ResultsId").append(html); 因为您想要的div的ID是“ResultsId”,所以您可以使用$(“#ResultsId')选择它。您当前有$(“#”+ResultsID),这将把变量ResultsID的值添加到“#”中。id必须
<div id="ResultsId">
Here are the results from the session!<br>
</div>
你好像打错了什么东西。试试这个:
$("#ResultsId").append(html);
因为您想要的div的ID是“ResultsId”,所以您可以使用
$(“#ResultsId')
选择它。您当前有$(“#”+ResultsID)
,这将把变量ResultsID
的值添加到“#”中。id必须是唯一的!未定义Use类insteadResultsId。您的参数名为DatesSearchResultsId。
function SearchDateAjax(DatesSearchResultsId){
$.ajax({
type: "POST",
url: "searchbydate.php",
cache: false,
data: "name=Peter&location=Sheffield&date=" + $('input[name="date"]').val(),
success: function(html, status){
$("#"+ResultsId).append(html);
//$('#status').append(status);
}
});
}
$("#ResultsId").append(html);