Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving sortable to mysql with ajax jquery and php
    primarykey
    data
    text
    <p>I have a page with multiple drag&amp;drop boxes, that works great, the thing that does not work are the links in the boxes. I would appreciate if someone could help me :). So I have a page where people can drag&amp;drop boxes (it works fine, as I said before), the links inside the boxes are sortable aswell, but I can't seem to get them to save the values to mysql. I think there is a conflict between the two drag&amp;drops, maybe I am doing it wrong, 'cause I haven't used ajax and jquery before.</p> <pre><code>//here is the jquery where I need to add some ajax $(function() { $('.dragbox-content').sortable({ connectWith: '.dragbox-content', update: function(event, ui) { var order=$(this).attr('id'); alert(order); // I get the order alert and it has one value that I need, but I need the sort order aswell } }); }); //this is the &lt;div&gt; that has the links in them and mysql query that gets the values //from two different databases, one is for the boxes and the other for links. //boxes db id = links title_id echo '&lt;div class="dragbox-content" id="order'.$widget['id'].'"';'&gt;''&lt;/div&gt;'; $sql10 = "SELECT u.*, w.id, w.link_address, w.link_name FROM db_boxes u LEFT JOIN db_links w ON u.link_id = w.id WHERE (u.username = '$username' AND u.link_id !='0' AND w.title_id = '".$widget['id']."' AND w.link_name !='pilt' AND w.rights = '0') OR (u.username = '$username' AND u.link_id !='0' AND w.title_id = '".$widget['id']."' AND w.link_name !='pilt' AND w.rights LIKE '%26%') ORDER BY w.id ASC"; $result10 = mysql_query($sql10) or die (mysql_error()); while ($row = mysql_fetch_array($result10)) { $link_id = $row['id']; $link_address = $row['link_address']; $link_name = $row['link_name']; $title_id = $row['title_id']; ?&gt; &lt;div class="move" id="&lt;?php echo $link_id;?&gt;"&gt; &lt;span class="link_style"&gt; &lt;div&gt;&lt;a href="&lt;?php echo $link_address; ?&gt;"&gt;&lt;?php echo $link_name;?&gt; &lt;/a&gt;&lt;/div&lt;/span&gt;&lt;/div&gt; </code></pre> <p>I just need somebody to tell me how can I save tile_id and sort_order to boxes database with ajax on every click a user makes on that page</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.
 

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