Note that there are some explanatory texts on larger screens.

plurals
  1. POPhoneGap and PrestaShop web service
    primarykey
    data
    text
    <p>I want to retrieve data from web service that (returns XML) of my PrestaShop web site. I use PhoneGap Android. I tried this code it gives me a good result on Internet Explorer, but not on my PhoneGap application.</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;PhoneGap&lt;/title&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;script type="text/javascript" charset="utf-8" src="js/Config/phonegap-0.9.3.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="css/jquery/jquery.mobile-1.0a1.min.css" /&gt; &lt;link rel="stylesheet" href="css/Style.css" /&gt; &lt;script src="js/Config/jquery-1.4.3.min.js"&gt;&lt;/script&gt; &lt;script src="js/Config/jquery.mobile-1.0a1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function getDescription() { var url = 'http://localhost/prestashop/api/customers/2'; req = new XMLHttpRequest(); req.onreadystatechange = processRequest; req.open("GET", url, true); req.send(null); } function processRequest() { if (req.readyState == 4) { if (req.status == 200) { alert ( "Not able to retrieve description+"+req.responseText ); parseMessages(); } else { alert ( "Not able to retrieve description+"+req.responseText+"vide" ); } } } function parseMessages() { response = req.responseXML.documentElement; itemDescription = response.getElementsByTagName('lastname')[0].firstChild.data; alert ( itemDescription ); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;button onClick="getDescription()"&gt;Ajax call&lt;/button&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I have also tried this code, but I face the same problem.</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;PhoneGap&lt;/title&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;script type="text/javascript" charset="utf-8" src="js/Config/phonegap-0.9.3.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="css/jquery/jquery.mobile-1.0a1.min.css" /&gt; &lt;link rel="stylesheet" href="css/Style.css" /&gt; &lt;script src="js/Config/jquery-1.4.3.min.js"&gt;&lt;/script&gt; &lt;script src="js/Config/jquery.mobile-1.0a1.min.js"&gt;&lt;/script&gt; &lt;script src="jquery.form.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $.ajax({ type: "GET", url: "http://localhost/prestashop/api/customers/2", //dataType: "xml", success: parseXml }); function parseXml(xml) {alert("a"); $(xml).find("customer").each(function() {alert("b"); $("#dropdownlist").append("&lt;hr&gt;"+$(this).find("lastname")[0].firstChild.data+"&lt;hr&gt;"); }); } }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="dropdownlist" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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