Code: Select all
select * from table_name where menu = '1';
I using onChange for combobox in javascript.
I already try in php with same database, and it's working. But when I try implement in open cart it's failed.
What i know problem is the url in ajax, because if i change code ajax. E.g change to alert it's working.
This for Ajax : ( I using jquery-1.7.1.min.js, already try with 1.9.1 too)
Code: Select all
$(document).ready(function() {
$('#id_menu').change(function() {
if ($(this).val != 0) { // If I change with alert, it's working ( Delete $.AJAX)
var menu_id = $(this).val(); // STORE variable menu (1-7) to menu_id
$.ajax({
type: "POST",
url: "index.php?route=item/edit_item/function_menu",
data: {
menu_id: menu_id
},
dataType: "html",
success: function(response) {
$("#data-menu").html(response);
}
});
}
}).change();
});
Code: Select all
public function function_menu()
{ // FUNCTION AJAX
echo "AAA";exit; // TRY ECHO for checking it's work or not ,and it's not working :(
$this->language->load('item/edit_item');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('item/edit_item');
if(isset($this->request->post['menu_id']))
$menu_id = $this->request->post['menu_id'];
else
$menu_id = null;
$data = array(
'menu' =>$menu_id,
);
}
http://s1064.photobucket.com/user/black ... sort=3&o=0
When i try change menu from "select menu" to 1-7,
it's display my home page again (repeated).