jquery - Send dynamic HTML list with PHP to server -



jquery - Send dynamic HTML list with PHP to server -

i have 2 simple html lists. first 1 contains bunch of entries, sec 1 empty. mutual list construction following:

<ul id="project-offer-list" class="connectedsortable"> <li class="ui-state-default"> <div> <!-- formatting --> </div> </li> <li class="ui-state-default"> <div> <!-- formatting --> </div>

the user can select entries first list dragging them sec one. doing can give preference sorting elements within sec list.

the drag-drop-mechanism realized jquery:

<script> $(function() { $("#project-offer-list, #project-selection-list").sortable({ connectwith: ".connectedsortable" }).disableselection(); }); </script>

i want send both selected elements (those in sec list) , order remote server php. whenever user clicks "save" button, current selection should sent.

how can accomplish this? need assign id each list element , somehow read sec list , order. crucial possible changes in html code made jquery considered.

thanks

you need convert info of sec list json object, assign id each element, utilize same id have in database more easy update , perform options on existing data,

var items = []; $('ul#list_id').find("li").each(function() { var $this = $(this); var item = { id: $(this).attr('data-id'), title: $(this).text() }; items.push(item); });

you this, , utilize ajax send remote server

[ {"id":"1","title":"school-management"}, {"id":"2","title":"library-management"}, {"id":"3","title":"billing_software"} ]

php jquery html

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -