title: How do I call a server api from my phonegap app?
body: <p>I'm struggling to understand something that i'm sure is pretty basic. I've searched around everywhere and can't find a solution to my problem. </p>
  
  <p>The most related stackoverflow question I found was this one: <a href="https://stackoverflow.com/questions/9464563/how-do-i-call-remote-api-using-phonegap-for-android">How do I call remote API using Phonegap for Android?</a></p>
  
  <p>That post looked promising, but still doesn't work for me. I'm building my first PhoneGap app and trying to use the Grouped api.</p>
  
  <p>I don't understand conceptually how to send and receive data from PhoneGap. I'm building everything locally, so I suppose this isn't technically PhoneGap related.</p>
  
  <p>Here is my api call: </p>
  
  <pre><code>http://grouped.com/api?f=user_exists&amp;email=ryan@ensomniac.com
  </code></pre>
  
  <p>Should return </p>
  
  <pre><code>{"msg": true}
  </code></pre>
  
  <p>But all I ever get when testing locally is "Error 200" with empty data. I feel like this guy: </p>
  
  <pre><code>http://www.youtube.com/watch?list=UU4_bwov47DseacR1-ttTdOg&amp;feature=player_detailpage&amp;v=GsqUZkmO-zk
  </code></pre>
  
  <p>I'm testing inside firefox 10.0.1 on Linux from 'localhost'. I assume running locally is as similar to PhoneGap as possible but could be wrong. </p>
  
  <p>Here's the code I have now that I assume should work (but obviously doesn't): </p>
  
  <pre><code>function makeRequest() {
      var request = new XMLHttpRequest();
      request.open("GET", "http://www.grouped.com/api?f=user_exists&amp;email=ryan@ensomniac.com", true);
      request.onreadystatechange = function() {
          if (request.readyState == 4) {
              if (request.status == 200 || request.status == 0) {
                  console.log(request);
              }
          }
      }
      request.send();
  }
  makeRequest();
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks for the help, always. </p>