Dny*_*van 5 php mysql ajax jquery
我创建了一个应用程序,因为有一个文本框用于从表中搜索信息.虽然我在搜索文本框中输入字符时编写了代码,但在接受一个字符控件后,文本框中没有.这是我的搜索代码
<script type="text/javascript">
$(document).ready(function()
{
var minlength = 1;
$("#searchTerm").keyup(function () {
value = $(this).val();
if (value.length > minlength )
{
searchTable(value);
}
else if(value.length < minlength)
{
searchTable("");
}
});
});
function searchTable(value)
{
$.ajax({
type: "GET",
url: "dispatient.php",
data:({search_keyword: value}),
success: function(success)
{
window.location.href = "dispatient.php?search_keyword="+value;
$("#searchTerm").focus();
},
error: function()
{
alert("Error occured.please try again");
},
complete: function(complete)
{
$("#searchTerm").focus();
},
});
}Run Code Online (Sandbox Code Playgroud)
<input id="searchTerm" Type="text" class="search_box" placeholder="Search"
value = <?php echo $_GET['search_keyword'] ?> >Run Code Online (Sandbox Code Playgroud)
"请建议我..
提前致谢..