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

LVL 1
ITsolutionWizardAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ITsolutionWizardAuthor Commented:
Any helps?
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
Any helps?

error message: ReferenceError: xmlnode is not defined

you got to define xmlnode in function: parseSelectXMLBondAmountList

and your requirement is not clear.
0
Julian HansenCommented:
It is not clear what you are asking as Ryan has pointed out xmlnode has not been defined. Looking at your data I am guessing you want something like this
function parseSelectXMLBondAmountList(xml, selectid,bondState,bondName) {
    var selecthtml = '', selectBondName, selectedbondAmountType;
// Not defined in your sample so I have commented it out
//    $('#' + selectid).prop("disabled", false);
   // Replaced xmlnode with GeneralInformation as that is the node
   // where bond information is defined
    $(xml).find('GeneralInformation').each(function (i,e) {
        if (bondState == $(this).find('State').text()) {
            alert("HI " + bondState);             
      }
    });
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.