Avatar of ITsolutionWizard
ITsolutionWizard
Flag for United States of America asked on

jquery, xml,

I have below jquery reading xml,
but not sure why below alert statement is not working.

Alert("HI " + bondState);


function fnGetBondAmount() {
    $.ajax({
        url: "http://localhost:5489/BondList.xml",
        success: function (xml) {
            parseSelectXMLBondAmountList(xml, "bondAmount", "CA", "Contractor")
        },
        error: function (xhr, ajaxOptions, thrownError) {
            alert("Status: " + xhr.status);
            alert("Error: " + thrownError);
        }
    });
}
function parseSelectXMLBondAmountList(xml, selectid,bondState,bondName) {
    var selecthtml = '', selectBondName, selectedbondAmountType;
    $('#' + selectid).prop("disabled", false);
    $(xml).find(xmlnode).each(function () {

        if (bondState == $(this).find('GeneralInformation').find('State').text()) {
            alert("HI " + bondState);             
      }
    });
}

<?xml version="1.0" encoding="utf-8"?>
<Surety>
  <SuretyLine>
    <Commercial>
      <Bond>
        <GeneralInformation UI="BondInfo">
		<State ID="bondState" PrefillValue="Yes">CA</State>
		<Product>A</Product>
	</GeneralInformation>
        <GeneralInformation UI="BondInfo">
		<State ID="bondState" PrefillValue="Yes">CA</State>
		<Product>B</Product>
	</GeneralInformation>
	<GeneralInformation UI="BondInfo">
		<State ID="bondState" PrefillValue="Yes">TX</State>
		<Product>C</Product>
	</GeneralInformation>
      </Bond>
    </Commercial>
  </SuretyLine>
</Surety>

Open in new window

jQueryXMLWeb DevelopmentJavaScript

Avatar of undefined
Last Comment
Julian Hansen

8/22/2022 - Mon
ITsolutionWizard

ASKER
Any helps?
Ryan Chong

Any helps?

error message: ReferenceError: xmlnode is not defined

you got to define xmlnode in function: parseSelectXMLBondAmountList

and your requirement is not clear.
ASKER CERTIFIED SOLUTION
Julian Hansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck