fukalotiseryu
New Member
I am trying to build a menu for my website and using Smarty to display the pages. When user click on the Logout option the JQuery send an Ajax call to index.php script which contain the code for Smarty to display the page but it is not displaying it. It was working fine before I added the menu. There is no error in the firebug too. Can someone put me in the right direction.Here is PHP code\[code\] if (isset($_POST['menu_index'])) { if ($_POST['menu_index'] == 'Logout') { $smarty->display("login.tpl"); exit; } }\[/code\]Here is JQuery code\[code\] $('ul li a').on('click', function() { var menuItemIndex = $(this).data('val'); console.log(menuItemIndex); $.ajax({ url: 'index.php', type: 'POST', data: { 'menu_index': menuItemIndex }, dataType: 'json', success: function(response) { alert('success'); }, error: function(errorMsg) { alert('failed'); } }); });\[/code\]Here is HTML Code\[code\]<form name="mainmenu" id="mainmenu"> <div id='content'> <div id='jqxMenu'> <ul> <li>Maintanence <ul style='width: 180px;'> <li><a href="http://stackoverflow.com/questions/15864638/#" data-val="addCategory">Add Category</a></li> <li><a href="http://stackoverflow.com/questions/15864638/#" data-val="addSubCategory">Add Sub-category</a></li> </ul> </li> <li>Process Order <ul style='width: 180px;'> <li><a href="http://stackoverflow.com/questions/15864638/#" data-val="addShipOrder">Ship Order</a></li> <li><a href="http://stackoverflow.com/questions/15864638/#" data-val="addChangeOrder">Change Order Status</a></li> </ul> </li> <li>Reports <ul style='width: 180x;'> <li><a href="http://stackoverflow.com/questions/15864638/#" data-val="addOrderStation">Orders by station</a></li> <li><a href="http://stackoverflow.com/questions/15864638/#" data-val="addOrderDate">Orders by date</a></li> <li><a href="http://stackoverflow.com/questions/15864638/#" data-val="addPendingOrder">Pending Orders</a></li> </ul> </li> <li><a href="http://stackoverflow.com/questions/15864638/#" data-val="Logout">Logout</a></li> </ul> </div> </div></form>\[/code\]