Witam,
mam napisaną funkcję sortable (w oddzielnym pliku php) która po wywołaniu działa poprawnie.
Natomiast gdy przy przypomocy funkcji load załaduję powyższy plik do div, sortable nie działa.
Zawartość pliki z funkcją sortable(po wywołaniu bezpośrednio tego pliku wszystko działa poprawnie)
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> <script type='text/javascript'>//<![CDATA[ $(window).load(function(){ $(document).ready(function () { $('ul').sortable({ axis: 'y', stop: function (event, ui) { var data = $(this).sortable('serialize'); $('span').text(data); /*$.ajax({ data: oData, type: 'POST', url: '/your/url/here' });*/ } }); }); });//]]> </script> <?php require_once('../classes/class.php'); $configuration_id = '1'; http://www.php.net/echo "<ul id='sortable'>"; foreach($configuration->showConfiguration($configuration_id) as $files) { http://www.php.net/echo "<li id='item-".$files['filename']."'>".$files['filename']."</li>"; } http://www.php.net/echo "</ul>"; ?> Query string: <span></span>
<http://december.com/html/4/element/script.html type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></http://december.com/html/4/element/script.html> <http://december.com/html/4/element/script.html> $( document ).ready(function() { $("#sortable").load("lib/sortable.php"); }); </http://december.com/html/4/element/script.html> <http://december.com/html/4/element/div.html id="sortable"></http://december.com/html/4/element/div.html>
Nie sprawdzałem ale spróbuj wyrzucić (ponieważ nie załadowałeś ponownie okna przeglądarki)
$(window).load(function(){}
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)