Using Ajax for display data from database
<p>I already learn from internet or another questions in this forum, but still confusion and this code still not work.</p>

<p>I trying display data using <code>onChange</code> by combo box menu(1-7), if 0 will be empty</p>

<p>This for code <code>html</code>&amp;<code>javascript</code> :</p>

<pre><code>&lt;html&gt;
    &lt;head&gt;
        &lt;script src="jquery-1.9.1.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;script type="text/javascript"&gt;
    $(document).ready(function() {
        $('#menu').change(function(){
            if($(this).val != 0){
                var menu_id = $(this).val();
                $.ajax({
                    type:       "GET",
                    url:        "menu.php",
                    menu_id :   menu_id,
                    dataType:   "html",
                    success: function(response){
                        $("#data-menu").html(response);
                    }
                });
            }
        }).change();
    )};
    &lt;/script&gt;

&lt;body&gt;
    &lt;table&gt;
        &lt;tr&gt;
            &lt;td&gt;Menu&lt;/td&gt;
            &lt;td&gt;
                &lt;select name="menu" id="menu"&gt;
                    &lt;option value="0" selected='selected'&gt;Select Menu &lt;/option&gt;
                    &lt;option value="1"&gt;Menu - 1 &lt;/option&gt;
                    &lt;option value="2"&gt;Menu - 2 &lt;/option&gt;
                    &lt;option value="3"&gt;Menu - 3 &lt;/option&gt;
                    &lt;option value="4"&gt;Menu - 4 &lt;/option&gt;
                    &lt;option value="5"&gt;Menu - 5 &lt;/option&gt;
                    &lt;option value="6"&gt;Menu - 6 &lt;/option&gt;
                    &lt;option value="7"&gt;Menu - 7 &lt;/option&gt;    
                &lt;/select&gt;   
            &lt;/td&gt;   
        &lt;/tr&gt;
    &lt;/table&gt;    
    &lt;div id="data-menu" align="center"&gt;
        &lt;!-- Show Data In Here --&gt;
    &lt;/div&gt;
&lt;/body&gt;
</code></pre>

<p></p>

<p>And this for menu.php</p>

<pre><code>&lt;?php
$connection=mysql_connect("localhost","root","");
if(!$connection)
    die('Cant connect !! '. mysql_error());

mysql_select_db("BK",$connection);
$menu_id= $_GET['menu_id'];

$result=mysql_query("select * from show_product where menu = '" . $menu_id . "' order by show_product_id",$connection);

$no = 0; // for number

echo "&lt;table border='1' &gt;
    &lt;tr&gt;
        &lt;td&gt;Menu :&lt;/td&gt;
        &lt;td&gt;".$menu_id."&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;No&lt;/td&gt;
        &lt;td&gt;Head Text&lt;/td&gt;
        &lt;td&gt;Title Text&lt;/td&gt;
        &lt;td&gt;Max Item&lt;/td&gt;
        &lt;td&gt;Date&lt;/td&gt;
        &lt;td&gt;Status&lt;/td&gt;
    &lt;/tr&gt;";

while($data = mysql_fetch_row($result))
{   
    echo "&lt;tr&gt;";
    $no+=1;
    echo "&lt;td&gt;".$no."&lt;/td&gt;";                                    //no
    echo "&lt;td&gt;".$data["head_text"]."&lt;/td&gt;";                 //head
    echo "&lt;td&gt;".$data["title_text"]."&lt;/td&gt;";                    //title
    echo "&lt;td&gt;".$data["max_item"]."&lt;/td&gt;";                      //max item
    echo "&lt;td&gt;".$data["date_added"]."&lt;/td&gt;";                    //date
    echo "&lt;td&gt;".'&lt;a href = "Edit_menu.php?id_menu='.$data["show_product_id"].'"&gt;EDIT&lt;/a&gt;'."&lt;/td&gt;";  // EDIT
    echo "&lt;/tr&gt;";
}
echo "&lt;/table&gt;";
?&gt;
</code></pre>