View Full Version : Can't get serialize after sortable to work jQuery

10-05-2011, 07:07 PM
I have this image gallery in which clients should be able to determine the order in which their images are shown. The sortable part works. Then I want to pass the new order to the next page called act_writeneworder.cfm (i am using coldfusion)
I just started with jQuery and it is driving me nuts:-) Each time I think I am having it well i am testing and the variable passed through gives an empty string.
My code:

<script type="text/javascript">
$(function() {
$( "#ulsortable" ).sortable();

sort_serialized = $('#ulsortable').sortable('serialize');
Then an unordered list:

<ul id="ulsortable">
<cfoutput query="items">
<li id="myprimarykey_#T_items_itemid#">
<img src="../#session.foldername#/galleries/#T_items_itemid#_thumbsitemanager.#T_items_img1#" alt="" border="0" width="125" height="125">
<CFIF #T_items_title# IS NOT "">#left("#T_items_title#","15")#</CFIF>

The variable sort_serialized is a hidden field in the form:

<form action="actions/act_writeneworder.cfm" method="post" id="frm_sort">
<input type="hidden" name="sort_serialized" id="sort_serialized" value="" />
<input type="submit" name="save" id="save" value="save" />

I am open to any other methods that do the same (but better:-))