我有两个 div
<div id="ResultsId">
Here are the results from the session!<br>
</div>
和
<div id="DatesSearchResultsId">
<a href="#" onclick="SearchDateAjax('DatesSearchResultsId');">Click here to search by date</a>
<form name="dateSearch" action="searchbydate.php" method="post">
date: <input type="date" name="date"><br>
</form>
</div>
如何使用 AppendTo() 方法将下面代码中的 html 输出附加到 ResultsId Div?我似乎无法让它工作:
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);
}
});
}