ajax工作了4次onchange事件后,它没有生成响应
//当dropdownlist值改变时,这是函数调用
function doAjaxPost(instituteId) {
alert(instituteId);
// get the form values
/* var name = $('#name').val();
var education = $('#education').val(); */
$.ajax({
type : "POST",
url : "/paymentGateway/merchant",
dataType : "json",
data : "institutionId=" + instituteId,
success : function(data) {
// we have the response
alert(data + "hiee");
var $merchantId = $('#merchant');
$merchantId.find('option').remove();
$("#merchant").append("<option value='ALL'>ALL</option>");
$.each(data, function(key, value) {
$('<option>').val(value.merchantId).text(value.merchantId)
.appendTo($merchantId);
});
},
error : function(e) {
alert('Error: ' + e);
}
});
}
// HTML代码
<select name="institutionId" onchange="doAjaxPost(this.value)" id="instiuteId">
<option value="ALL">ALL</option>
<c:forEach var="institute" items="${instititionList}">
<option value="${institute.institutionId}">${institute.institutionId}</option>
</c:forEach>
</select>
//这是下拉列表,只要在制度下拉列表中发生onchange事件时就应该加载该下拉列表
<select name="merchantId" id="merchant">
<option value="ALL">ALL</option>
<c:forEach var="merchant" items="${merchantList}">
<option value="${merchant.merchantId}">${merchant.merchantId}</option>
</c:forEach>
</select>