0
我有兩個div追加HTML輸出到不同的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>
如何將HTML輸出追加從下面的代碼來使用AppendTo的ResultsId股利()方法?我似乎無法得到它的工作:
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);
}
});
}
ID必須是唯一的!改爲使用類 –
ResultsId未定義。您的參數稱爲DatesSearchResultsId。 – algorhythm