Code: Select all
<?php
$this->smarty->assign('urlajax', $this->CreateLink($id, 'save_order_categories_tree', $retrunid, '', array('disable_theme' => true, 'showtemplate' => false ), '', true));
$this->smarty->assign('tree', $this->_RenderTree($this->_getTree()));
echo $this->ProcessTemplate('categories.tpl');
Code: Select all
'http://localhost/cms/admin/moduleinterface.php?mact=Sklep,m1_,save_order_categories_tree,0&sp_=5d2fce4f&m1_disable_theme=true&m1_showtemplate=false'
Code: Select all
<__script__ type="text/javascript">
var ajax_url = '{$urlajax}';
{literal}
$(document).ready(function(){
$('ul.sortable').nestedSortable({
disableNesting: 'no-nest',
forcePlaceholderSize: true,
handle: 'div',
items: 'li',
opacity: .6,
placeholder: 'placeholder',
tabSize: 10,
tolerance: 'pointer',
toleranceElement: '> div'
});
$("#save").click(function(){
var tree = $('ul.sortable').nestedSortable('toArray', {startDepthCount: 0});;
var ajax_res = false;
$.ajax({
type: 'POST',
url: ajax_url,
data: {data: tree},
cache: false,
async: false,
success: function(res) {
ajax_res = true;
console.log(res);
alert(res);
}
});
//console.log(ajax_res);
return ajax_res;
});//end save
$('#toArray').click(function(e){
arraied = $('ul.sortable').nestedSortable('toArray', {startDepthCount: 0});
console.log(arraied);
})
});//end ready
{/literal}
</__script>
{$tree}
<button id="save">save</button>
What is going wrong... ? please help...

UPDATE:
I've just solved it... Why, the method of CMS Made Simple for generating link (CreateLink) add's the "amp;" word??? to the final link???, ajax call work's only if the link is looks like that:
Code: Select all
http://localhost/cms/admin/moduleinterface.php?mact=Sklep,m1_,save_order_categories_tree,0&sp_=aa8730e6
Code: Select all
http://localhost/cms/admin/moduleinterface.php?mact=Sklep,m1_,save_order_categories_tree,0&sp_=aa8730e6
Code: Select all
$link = 'http://localhost/cms/admin/moduleinterface.php?mact=Sklep,m1_,save_order_categories_tree,0&sp_=aa8730e6';
$good_link = str_replace('amp;', '', $link);