Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

xml, jquery, html5

I have jquery, xml call, and try to return some value while reading it. Please read the comment below and you will know my questions.

function fnGetBondAmount() {
    $.ajax({
        url: "http://localhost:5489/BondList.xml",
        success: function (xml) {
            parseSelectXMLBondAmountList(xml, "bondAmount", "CA", "DMV Traffic Violators School Classroom")
        },
        error: function (xhr, ajaxOptions, thrownError) {
            alert("Status: " + xhr.status);
            alert("Error: " + thrownError);
        }
    });
} 
function parseSelectXMLBondAmountList(xml, selectid, bondState, bondName) {
    var html = "";
    $('#' + selectid).prop("disabled", false);
    $(xml).find('GeneralInformation').each(function (i,e) {
        {
            if(bondState==$(this).find('State').text())
            {
                var selectedBondName = $(this).find('Name').text();
                if (selectedBondName == bondName) {
                    var selectedBondName = $(this).find('Name').text();
		    // code begin
			return me Coverage Type value (in this case it will be List)
			return me Amount 'Min' and 'Max' value (in this case it will be 10000, 10000)
		   // code end
                 }
             }            
        }
    });
    alert(html);
}


<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="10000322" Max="100032430" Year="1">10000</Amount>
         </Coverage>              
      </Bond>
</Commercial>
  </SuretyLine>
</Surety>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ITsolutionWizard

ASKER

with your codes and xml. the alert now show blank.
I got it working now. Thanks.
you are welcome.