title: How to check if XML string contains certain value in jQuery
body: <p>I would like to use Ajax to check if an XML string ("<code>data</code>") contains a certain value under "<code>voteBy</code>", e.g. the name "<code>John Doe</code>". If yes, then I want to show an alert, if not then show another alert. The idea behind is that I want to do something here later with jQuery but only if the search term is NOT found in the XML string.</p>
  
  <p>I tried the below which is the success function of the Ajax call to fetch this XML string. In this case it should alert "found" as the search term appears in the XML string but my approach doesn't return anything.</p>
  
  <p>Can someone tell me what I am doing wrong here? Note: Data for the XML can vary so there may be more or less or no votes for a certain item.</p>
  
  <p><strong>My XML looks as follows (example data, shortened):</strong> </p>
  
  <pre><code>&lt;ranks&gt;
    &lt;itemDetails&gt;
      &lt;itemID&gt;1&lt;/itemID&gt;
      &lt;title&gt;Test item&lt;/title&gt;
      &lt;details&gt;&amp;lt;p&amp;gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit...&amp;lt;/p&amp;gt;&lt;/details&gt;
      &lt;lastUpdate&gt;Added&lt;/lastUpdate&gt;
      &lt;modTime&gt;Saturday, 23 August 2014&lt;/modTime&gt;
      &lt;modBy&gt;Someone&lt;/modBy&gt;
      &lt;comments&gt;
        &lt;commentID&gt;1&lt;/commentID&gt;
        &lt;comment&gt;Some comment&lt;/comment&gt;
      &lt;/comments&gt;
      &lt;comments&gt;
        &lt;commentID&gt;2&lt;/commentID&gt;
        &lt;comment&gt;Another comment&lt;/comment&gt;
      &lt;/comments&gt;
      &lt;votes&gt;
        &lt;voteBy&gt;John Doe&lt;/voteBy&gt;
      &lt;/votes&gt;
      &lt;votes&gt;
        &lt;voteBy&gt;Jane Doe&lt;/voteBy&gt;
      &lt;/votes&gt;
    &lt;/itemDetails&gt;
  &lt;/ranks&gt;
  </code></pre>
  
  <p>My jQuery (success function only, shortened) - data here is my XML string:</p>
  
  <pre><code>$.ajax({
      // ...
      success:function(data) {    
          if(!$(data).find('voteBy').text() == 'John Doe') {
              alert('not found');
          } else {
              alert('found');
          }
      }
  });
  </code></pre>