下面的代码是我的$ .ajax请求,返回值应该是一个'select'标签填充,虽然我一直得到一个空的'select'标签,我已经检查了它调用的php页面,甚至输入了变量通过URL检查它是否正常工作,它确实有效...在php页面上,但它不会转发下拉列表和'select'标签。有人有什么想法吗?
function sendCategoryRequest() {
var URL = $('#indStore1').val();
var site = $('#site').val();
if ($.ajax({
type: "GET",
url: "../dashboard/sendgcr.php",
data: { URL: URL, site: site },
dataType: "html",
timeout: 4000,
success: function (response) {
if (response != "") {
document.getElementById('LCatC').innerHTML = response;
alert(response);
} else {
alert("Nothing came back :(");
}
}
})) {
} else {
alert("Proccessing Stage 2 Failed!");
}
}// end sendCategoryRequest
这是我的回复(HTML格式):
<span style = 'float: left;
clear: left;
margin-right: 20px;'>
Category (Leaf):
</span>
<select id = 'LCat'
style = 'float: left;'>
</select>
应该是:
<span style = 'float: left;
clear: left;
margin-right: 20px;'>
Category (Leaf):
</span>
<select id = 'LCat'
style = 'float: left;'>
<option value = '(value recieved here)'>(Name recieved here)</option> // repeated until no more options present in the arrays
</select>