asked on
<Surety>
<SuretyLine>
<Commercial>
<Bond>
<GeneralInformation UI="BondInfo">
<Name ID="bondName" PrefillValue="Yes">DMV Traffic Violators School Classroom</Name>
<State ID="bondState" PrefillValue="Yes">CA</State>
</GeneralInformation>
<Coverage Type="List">
<Amount PrefillValue="No" Min="10000" Max="10000" Year="1">10000</Amount>
</Coverage>
</Bond>
<Bond>
<GeneralInformation UI="BondInfo">
<Name ID="bondName" PrefillValue="Yes">DMV Traffsdfasdfads</Name>
<State ID="bondState" PrefillValue="Yes">CA</State>
</GeneralInformation>
<Coverage Type="List">
<Amount PrefillValue="No" Min="10000" Max="20000" Year="1"></Amount>
<Amount PrefillValue="No" Min="20000" Max="30000" Year="1"></Amount>
</Coverage>
</Bond>
</Commercial>
</SuretyLine>
</Surety>
function fnGetBondAmount() {
$.ajax({
url: "http://localhost:5489/BondList.xml",
success: function (xml) {
parseSelectXMLBondAmountList(xml, "bondAmount", localStorage.getItem('bondState'), localStorage.getItem('bondName'))
},
error: function (xhr, ajaxOptions, thrownError) {
alert("Status: " + xhr.status);
alert("Error: " + thrownError);
}
});
}
function parseSelectXMLBondAmountList(xml, selectid, bondState, bondName) {
var html = "";
var htmlOption = "";
$('#' + selectid).prop("disabled", false);
$(xml).find('Bond').each(function (i, e) {
{
if (bondState == $(e).find('GeneralInformation').find('State').text() && bondName == $(e).find('GeneralInformation').find('Name').text())
{
var selectedBondName = $(e).find('GeneralInformation').find('Name').text();
var coverageType = $(e).find('Coverage').attr('Type');
if (coverageType == "list") {
var AmountMax = $(e).find('Amount').attr('Max');
var AmountMin = $(e).find('Amount').attr('Min');
htmlOption += "<option>" + AmountMax + "</option>";
}
else {
var AmountMax = $(e).find('Amount').attr('Max');
var AmountMin = $(e).find('Amount').attr('Min');
$('#bondAmountPlaceHolder').append("<input type='text' id='bondAmount' name='bondAmount' value='" + AmountMax + " />");
}
}
}
});
$("#" + selectid).html(htmlOption);
}
<select disabled class="select2" id="bondAmount" name="bondAmount" data-placeholder=""></select>