Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery, ajax and php
    primarykey
    data
    text
    <p>I have this code to present images:</p> <pre><code>&lt;?php foreach ($images as $row) : ?&gt; &lt;div class="box col_3"&gt; &lt;p&gt;&lt;a href="&lt;?php echo base_url() ?&gt;public/images/fullscreen/&lt;?php echo $row['image'] ?&gt;" rel="prettyPhoto[gallery1]" title="&lt;?php echo $row['title'] ?&gt;"&gt; &lt;img src="&lt;?php echo base_url() ?&gt;public/images/thumbnails/&lt;?php echo $row['image_thumb'] ?&gt;" title="&lt;?php echo $row['title'] ?&gt;" &gt;&lt;/a&gt;&lt;/p&gt; &lt;textarea name="title_image" rows="3" class="title_image"&gt;&lt;?php echo $row['title'] ?&gt;&lt;/textarea&gt; &lt;input type="hidden" class="id_image" class="id_image" value="&lt;?php echo $row['id_image'] ?&gt;" &gt; &lt;input type="submit" name="update_image" id="update_image" value="Update" class="submit" /&gt;&lt;br&gt; &lt;a href="#" class="delete" id="&lt;?php echo $row['id_image'] ?&gt;"&gt;Delete image&lt;/a&gt; &lt;/div&gt; &lt;?php endforeach; ?&gt; </code></pre> <p>User can upload an image, and for every image div with class of box is created. This is the code which sends data for update.</p> <pre><code>$(function(){ $('.submit').click(function(){ ('.box').append('&lt;img src="&lt;?php echo IMG ?&gt;loadinfo.net.gif" id="loading" /&gt;'); var id = $('.id_image').val(); var title = $('.title_image').val(); $.ajax({ url: "&lt;?php echo site_url('gallery/update_image') ?&gt;", type: 'POST', data: 'id=' + id + '&amp;title=' + title, success: function(){ $('#loading').fadeOut(500, function(){ $(this).remove(); }); } }); return false; }); }); </code></pre> <p>This works just for the first box, and for the rest it doesn't. What I need to do to make it work?</p>
    singulars
    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