Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is a snippet from an App I working on, I get some data from PHP (JSON), I use "function log" to put the table into a div, you can customize a CSS (div class="yourCSSClass") to get a fancy div.</p> <pre><code> function log(message, div) { switch(div){ case 1: $("#log").empty(); $("&lt;div/&gt;").html(message).prependTo("#log"); $("#log").attr("scrollTop", 0); break; case 2: $("#log2").empty(); $("&lt;div/&gt;").html(message).prependTo("#log2"); $("#log2").attr("scrollTop", 0); break; } } $('#item').autocomplete({ source: function(request, response) { $.ajax({ url: "itemsJson.php", dataType: "json", data: { term: request.term, }, success: function(data) { response($.map(data, function(item) { return { label: item.label, value: item.value, id: item.id, name: item.name, location: item.location, rfidpic: item.rfidPicture } })) } }) }, select: function(event, ui) { log(ui.item ? ( "&lt;table border=0&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td colspan='3'&gt;&lt;b&gt;" + ui.item.id + "&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;img src='" + ui.item.rfidpic + "' style='margin: 0 right; width=" + "'60'" + " height=" + "'60'" + "'/&gt;&lt;/td&gt;&lt;/tr&gt;" + "&lt;tr&gt;&lt;td colspan='2' align='center'&gt;Name&lt;/td&gt;&lt;td colspan='2' align='center'&gt;Location&lt;/td&gt;&lt;/tr&gt;" + "&lt;tr&gt;&lt;td colspan='2' align='center'&gt;" + ui.item.name + "&lt;/td&gt;&lt;td colspan='2' align='center'&gt;" + ui.item.location + "&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;" ) : "Please select an item" + this.id, 1); } }); </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