title: couldn't get json from url
body: <p>I am trying to get json from a url but did not succeed..</p>
  
  <p>here is my code. i am trying using jsonParse method.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;!--&lt;link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"&gt;--&gt;
      &lt;link rel="stylesheet" href="&lt;?php getBaseURL(); ?&gt;style.css"&gt;
      &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;    
      &lt;div class="container-fluid"&gt;
          &lt;!--&lt;div id="menu"&gt;&lt;/div&gt;--&gt;
              &lt;!--&lt;img class="img-responsive" src="http://f1.haveeru.com.mv/photos/2014/08/0_14082524222_news.jpg" /&gt;
          &lt;img src="http://f1.haveeru.com.mv/dhivehi/images/haveeru_logo_m.jpg" /&gt;--&gt;
          &lt;div id="demo"&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;script language="javascript"&gt;
  
          var url = "http://api.haveeru.com.mv/articles/read/160917";
  
          xmlhttp.onreadystatechange = function() {
              if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
                  var myArr = JSON.parse(xmlhttp.responseText);
                  myFunction(myArr);
              }
          }
          xmlhttp.open("GET", url, true);
          xmlhttp.send();
  
          function myFunction(arr) {
              var out = "";
  
              out += arr.heading;
              }
              alert(out);
          }
  
  
  &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>it is not even alerting anything..</p>
  
  <p>any help would be appriciated.. thank you</p>