Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to access api in blackberry 10 using html5 and javascript
    text
    copied!<p>I am new to blackberry 10. I am developing an app using html5 and javascript via phonegap.I am unable to fetch the data from the api when i run the application in ripple emulator. Unexpectedly i am getting xmlhttp status -> 0. </p> <p>when i hit the api url on browser it works fine. Don't know what is exact problem.</p> <p>Please assist me how to access api in blackberry10?</p> <p>I am attaching my code here.</p> <p>HTML code :</p> <pre><code>&lt;div data-role="page" id="homePage"&gt; &lt;div data-role="header"&gt; &lt;div&gt; &lt;div class="choose-city-head-A"&gt; &lt;span &gt;&lt;img src="images/m.png" height="70%" style="margin-top:12px;margin-left:45%;" /&gt;&lt;/span&gt; &lt;span style="float:right; margin-top:25px; margin-right:20px;"&gt;&lt;img src="images/close.png" height="40%" /&gt;&lt;/span&gt; &lt;span style=" float:right;margin-right:20px; margin-top:25px;"&gt;&lt;img src="images/help.png" height="40%" /&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class="choose-city-head-B"&gt; &lt;h2&gt; Choose City &lt;/h2&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div data-role="content"&gt; &lt;div id="home_data" &gt;&lt;/div&gt; &lt;/div&gt; &lt;div data-role="footer" class="choose-city-head-A" data-position="fixed"&gt; &lt;img src="images/prev_button.png" style="margin-left:90px;" /&gt; &lt;img src="images/favourities.png" style="margin-left:60px;" /&gt; &lt;img src="images/sms.png" style="margin-left:60px;" /&gt; &lt;img src="images/next.png" style="margin-left:60px;" /&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>javascript code :</p> <pre><code>var xmlhttp = new XMLHttpRequest(); function showHome() { xmlhttp.open("GET", "url", true); // xmlhttp.setRequestHeader("Content-Type","text/xml"); xmlhttp.send(null); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { alert(xmlhttp.status); //status i am receiving is 0 if (xmlhttp.status == 200) { var responsexml=xmlhttp.responseText; var xmlDoc=xmlhttp.responseXML; } } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload