在
auto.jsp“ #combo”更改匿名功能中,替换为:
$.getJSON('combo1.jsp', {firstcombobox : this.value}, function(responseData) { $("#combo1").append( $("<option></option>").html(responseData.name).val(responseData.name) );});与:
$.getJSON('combo1.jsp', {firstcombobox : this.value}, function(responseData) { $("#combo1").empty().append( $("<option></option>").html(responseData.name).val(responseData.name) );});要将字符串拆分为数组,请按以下步骤进行操作:如何将字符串拆分为特定字符?
它们的用法如下:
$.getJSON('combo1.jsp', {firstcombobox : this.value}, function(responseData) { var splitValues = responseData.name.split(/,/); $("#combo1").empty().append("<option value="0">Please select...</option>"); for (var idx in splitValues) { $("#combo1").append( $("<option></option>").html(splitValues[idx]).val(splitValues[idx]) ); }});希望这可以帮助?



