Note that there are some explanatory texts on larger screens.

plurals
  1. POGetJSON in Android using Phonegap not working properly
    text
    copied!<p>I have a problem with displaying data on a page using the GetJSON() function jQuery provides. </p> <p>Developing an application for Android (2.3 and up) using JQuery (Mobile) and Phonegap to compile it. As I was writing code and testing, the actual function GetJSON() works fine when trying on my browser. As I let it being wrapped up by Phonegaps BUILD functionality, the data would not display in my Android Phone (Gingerbread). It does, however, work on Androids' Jelly Bean. </p> <p>Could there be any problem with the version or is there something wrong with the code? I have been working hours on this and I am relatively new to jQuery and JavaScript... just can't seem to figure it out.</p> <p>JSON File (Small part, validated &amp; works):</p> <pre><code>"workshops": [ { "id": "1", "titel": "Jurimix", "leider": "H Hoek, W Nijenhuis, M Visser, V de Vries, E de Boer", "inhoud": "In het tweede en derde jaar van de JD-opleiding werken leerlingen in kleine teams samen in het projekt Jurimix. Zij formuleren juridische adviezen naar aanleiding van casuïstiek ontleend aan de beroepspraktijk. Regelmatig worden klantgesprekken, ook met externe klanten, geoefend waarin een juridisch probleem van de klant centraal staat. Veel aandacht wordt besteed aan de communicatieve vaardigheden bij klantgesprekken.", "ruimte": "Marny", "maxdeelnemers": "25", "doelgroep": "", "tijd": "11:30 &amp; 14:00" }, { "id": "2", "titel": "Maak je droomschilderij", "leider": "M vd Hulst", "inhoud": "Tijdens deze workshop kan je, met behulp van gemengde technieken, je droomschilderij maken die we later tentoonstellen.", "ruimte": "A1.21", "maxdeelnemers": "20", "doelgroep": "", "tijd": "10:30 &amp; 11:30 &amp; 14:00" }, </code></pre> <hr> <p>Then there is my function to display the JSON data:</p> <pre><code>function loadWorkshops(){ $.ajax({ url: "file.json", dataType: "json", mimeType: "textPlain" }) .done(function(data){ var shoarmaID = parseInt(getURLParameter('id')); $("#shoarma1").append('&lt;b&gt;' + data.workshops[shoarmaID].titel + '&lt;/b&gt;&lt;br&gt;Workshopleider(s): ' + data.workshops[shoarmaID].leider + '&lt;br&gt;Beschrijving: ' + data.workshops[shoarmaID].inhoud + '&lt;br&gt;Ruimte: ' + data.workshops[shoarmaID].ruimte + '&lt;br&gt;Max Deelnemers: ' + data.workshops[shoarmaID].maxdeelnemers + '&lt;br&gt;Tijden: ' + data.workshops[shoarmaID].tijd); }); } </code></pre> <hr> <p>To explain the GetURLParameter:</p> <pre><code>function getURLParameter(name) { return decodeURIComponent((new RegExp('[?|&amp;]' + name + '=' + '([^&amp;;]+?)(&amp;|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null } </code></pre> <p>When clicked on a button it sends an ID (which represents a workshop) and adds it to the url (being workshop.html?id=[number].</p> <p>I have a live version running at <a href="http://gpd.ihazmusicblog.com" rel="nofollow">gpd.ihazmusicblog.com</a></p> <p>Please help, this thing needs to be done before next monday!</p> <p>Thanks in advance!</p>
 

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