Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying image using jQuery and Json
    primarykey
    data
    text
    <p>I have a database which contains the HTML Source for the image. Using jQuery and Json; I want to display the image. Here is the snippet I have written for it,</p> <pre><code>$(document).ready(function() { $("#domainID").click(function() { var domain_id = $(this).val(); $("#picture").html(''); $.getJSON('/index.php/admin/show_picture/' + domain_id, function(data) { img = "&lt;img src=\"https://url/" + data.htmlImageFull + "\" /&gt;"; var items = []; $.each(data, function(key, val) { $("#picture").append(data[key].htmlImageFull); }); }); }); }); </code></pre> <p>The main thing is I will be retrieving the html source using the ID of the image associated with it. Any changes I have to make here? I am also using MySQL to check the id associated with the image.</p> <p>and Here is the HTML,</p> <pre><code>&lt;form method="post" action="/index.php/add"&gt; &lt;p&gt; &lt;select name="id" id="id" size="15"&gt; &lt;option&gt;Select a Domain&lt;/option&gt; &lt;? foreach ($unmatchedDomains as $row) { ?&gt; &lt;option value="&lt;?=$row-&gt;id?&gt;"&gt;&lt;?=$row-&gt;domain ?&gt;&lt;/option&gt; &lt;? }?&gt; &lt;/select&gt; &lt;/td&gt; &lt;select name="id" id="id"&gt; &lt;option style="alignment-adjust: &amp;#x2190;"&gt;Select Something&lt;/option&gt; &lt;? foreach ($some as $row) { ?&gt; &lt;option value="&lt;?=$row-&gt;id?&gt;"&gt;&lt;?=$row-&gt;name ?&gt;&lt;/option&gt; &lt;? }?&gt; &lt;/select&gt; &lt;input type="submit" value="Something" /&gt; &lt;div id="email_content"&gt;&lt;/div&gt; &lt;div id="picture"&gt;&lt;/div&gt; &lt;/p&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>Testing with the provided code shows no picture/image.</p>
    singulars
    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.
 

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