We help IT Professionals succeed at work.

jquery, xml, reading

174 Views
Last Modified: 2019-01-28
I want to do something like in jquery

if the state = "CA" and bondname = "Contractor1" then
      show me the status element value e.g. "Online"

how can I do that in Jquery?

<Surety>
  <SuretyLine>
    <Commercial>
      <Bond>
        <GeneralInformation UI="BondInfo">
          <Name ID="bondName" PrefillValue="Yes">Contractor 1</Name>
          <State ID="bondState" PrefillValue="Yes">CA</State>
       </GeneralInformation>
         <Image></Image>
        <Status>Online</Status>
      </Bond>
  <Bond>
        <GeneralInformation UI="BondInfo">
          <Name ID="bondName" PrefillValue="Yes">Contractor 2</Name>
          <State ID="bondState" PrefillValue="Yes">CA</State>
       </GeneralInformation>
         <Image></Image>
        <Status>Online</Status>
      </Bond>
            <Bond>
        <GeneralInformation UI="BondInfo">
          <Name ID="bondName" PrefillValue="Yes">Contractor asdfasd</Name>
          <State ID="bondState" PrefillValue="Yes">FL</State>
       </GeneralInformation>
         <Image></Image>
        <Status>Online</Status>
      </Bond>
</Commercial>
</SuretyLine>
</Surety>

Open in new window

Comment
Watch Question

Author

Commented:
any helps?

Author

Commented:
any helps?
Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
This is different from the one you helpef
leakim971Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
my answer to this new one would be the same, for a give value "CA" find an other one in the same node.

Author

Commented:
It is not the same this time I need status
leakim971Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
so if you have 100 fields in a node, and you need to get each value, you gonna post 100 questions?
That's why I suggest you to make the code your own. No matter which field you need to read the value, the logic doesn't change.

Author

Commented:
It is okay. I just wait for other helps
CERTIFIED EXPERT
Top Expert 2004

Commented:
Based on the solution you received in https://www.experts-exchange.com/questions/29063891/JAVASCRIPT-XML.html, what work have you done towards adapting that towards this goal?

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions