当前位置: 动力学知识库 > 问答 > 编程问答 >

jquery auto complete how php file fetch textbox value?

问题描述:

I am working on an autocomplete feature using jQuery and PHP. Everything is working fine but I can't understand how the PHP file should fetch the value of the textbox (because I have not posted the Form)

$("#auto_complete").autocomplete({

source: "search.php",

minLength: 1

});

PHP:

<?php

require('connection.php');

$searchTerm = $_GET['term'];

$query="SELECT b_type FROM b_details WHERE b_type LIKE '%".$searchTerm."%'";

$result=mysql_query($query);

while ($row =mysql_fetch_array($result))

{

$data[] = $row['b_type'];

}

//return json data

echo json_encode($data);

?>

分享给朋友:
您可能感兴趣的文章:
随机阅读: