Note that there are some explanatory texts on larger screens.

plurals
  1. POBuilding html from an ajax call to jquery UIs sortable list
    primarykey
    data
    text
    <p>Im having a design problem in HTML/JavaScript.</p> <p>I appended jquery UIs sortable to my web-application: Heres a demo on sortable (cant show my application now): <a href="http://jqueryui.com/demos/sortable/default.html" rel="nofollow noreferrer">http://jqueryui.com/demos/sortable/default.html</a></p> <p>Now im populating that drag and drop list in JavaScript with data from an ajax call. The list is changed by users all the time.</p> <p>I try do something like this:</p> <pre><code>Var htmlData = '&lt;div id=wrapper&gt;' +'&lt;div&gt;' +data.title +'&lt;/div&gt;' +'&lt;div&gt;' +data.description +'&lt;/div&gt;'; ${"#sortable-list"}.html(htmlData); </code></pre> <p>And so on. Some of the divs also have attributes set in variables like <code>'id="' + data.id + '"'</code> I then try to fit this string htmldata in the sortable-list. But it's getting messy pretty quick. I tried to fit <code>&lt;tables&gt;</code> in it, and <code>&lt;p&gt;</code> with <code>&lt;span&gt;</code>s in. But it's still hard to get the design that I want.</p> <p>Cant post images due to lack of reputation but here's the design i want (this is just one <code>&lt;li&gt;</code> in the <code>&lt;ul&gt;</code>):</p> <p><a href="http://img546.imageshack.us/img546/9179/48361880.gif" rel="nofollow noreferrer">http://img546.imageshack.us/img546/9179/48361880.gif http://img546.imageshack.us/img546/9179/48361880.gif</a></p> <p>So how would you do this? I've been reading about templates like mustache but it don't seems to help me. And the way I building the table with a string can't be the best way.</p> <p>Any example or info on how to do this is much appreciated </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