Javascript:搜索自动完成 - 从mysql数据库中获取结果?

I am trying to achieve a search bar on my website that shows a list of suggestive search results as a user types them in.

So if someone starts to type in Hew

and the value Hewden exists in my database then this will show up in the suggestive search results drop down list

I have the following html form setup on my page search.php:

search.php

<form action="include/search_source.php" method="post" name="searchForm">
<input type="text" name="search" class="Search_bar_box" id="search" autocomplete="off">
</form>


<script>
jQuery(document).ready(function($){
    $('#search').autocomplete({source:'include/search_source.php', minLength:2, select: function (event, ui) {
            window.location = 'search_results.php?search=' + ui.item.value;

        }});

    $('#searchForm').on("submit", function (event) {
        event.preventDefault();
        alert($('#search').val());
    });

});


</script>

In search_source.php i have the following code which runs a mysql query which is suppose to lookup my values from the database:

search_source.php:

<?php
include 'config.php';

$rs = mysql_query('select * from supplier_stats where company_name like "'. mysql_real_escape_string($_REQUEST['term']) .'%" OR supplier_number like "'. mysql_real_escape_string($_REQUEST['term']) .'%" OR descrip like "'. mysql_real_escape_string($_REQUEST['term']) .'%" order by company_name asc limit 0,5');

// loop through each zipcode returned and format the response for jQuery
$data = array();
if ( $rs && mysql_num_rows($rs) )
{
    while( $row = mysql_fetch_array($rs, MYSQL_ASSOC) )
    {
        $data[] = array(
            'label' => $row['company_name'] .' - '. $row['supplier_number'] .' - '. $row['descrip'] ,
            'value' => $row['company_name']
        );
    }
}

// jQuery wants JSON data
echo json_encode($data);
flush();

?>

I am then including search.php in my page dashboard.php like so:

<?php include 'search.php'; ?>

For some reason this code works on my local host server but doesn't work on my main server. can someone please show me what i am doing wrong? or perhaps show me a better way of doing this? Thanks in advance