Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code> var json = eval( "(" + '&lt;?php echo $data; ?&gt;' + ")" ); </code></pre> <p>Try to check:<br> 1. the JSON string doesn't contain carriage returns.<br> 2. the method chain. The outermost structure is an Array. It should be json[0] or json[1]["1"].</p> <p>The following script works for me.</p> <pre><code> &lt;body&gt; &lt;input type="text" id="query" /&gt;&lt;button&gt;search&lt;/button&gt;&lt;br /&gt; &lt;div id="results"&gt; &lt;/div&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $('button').click(function(){ var json = eval('(' + '["http:\/\/guimaraes-braga.olx.pt\/seat-leon-1-9tdi-sport-111cv-iid-148286318", {"1":"http:\/\/static04.olx-st.com\/images\/v4\/logos\/logo-default.png"}, {"2":"http:\/\/images03.olx.pt\/ui\/10\/71\/18\/t_1292857323_148286318_1.jpg"}, {"3":"http:\/\/images04.olx.pt\/ui\/10\/71\/18\/t_1292886514_148286318_2.jpg"}, {"4":"http:\/\/images04.olx.pt\/ui\/10\/71\/18\/t_1292886514_148286318_3.jpg"}, {"5":"http:\/\/images02.olx.pt\/ui\/10\/71\/18\/t_1292886514_148286318_4.jpg"}, {"6":"http:\/\/images02.olx.pt\/ui\/10\/71\/18\/t_1292886514_148286318_5.jpg"}, {"7":"http:\/\/images02.olx.pt\/ui\/10\/71\/18\/t_1292886514_148286318_6.jpg"}, {"8":"http:\/\/images03.olx.pt\/ui\/10\/71\/18\/t_1292857323_148286318_1.jpg"}, {"9":"http:\/\/images04.olx.pt\/ui\/10\/71\/18\/t_1292886514_148286318_2.jpg"}, {"10":"http:\/\/images04.olx.pt\/ui\/10\/71\/18\/t_1292886514_148286318_3.jpg"}, {"11":"http:\/\/images02.olx.pt\/ui\/10\/71\/18\/t_1292886514_148286318_4.jpg"}, {"12":"http:\/\/images02.olx.pt\/ui\/10\/71\/18\/t_1292886514_148286318_5.jpg"}, {"13":"http:\/\/images02.olx.pt\/ui\/10\/71\/18\/t_1292886514_148286318_6.jpg"}, {"14":"http:\/\/images01.olx.com\/images\/spinner.gif"}, {"15":"http:\/\/images01.olx.pt\/ui\/10\/71\/18\/1292886514_148286318_1-Fotos-de--SEAT-LEON-19TDI-SPORT-111CV.jpg"}, {"16":""}]' + ')'); for (var i=1; i&lt;json.length; i++){ $("#results").append('&lt;p&gt;' + json[i][i] + '&lt;/p&gt;'); } }); }); &lt;/script&gt; &lt;hr /&gt; &lt;/body&gt; </code></pre> <p></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