我创建了一个应用程序,其中有一个用于从表中搜索信息的文本框。尽管当我们在搜索文本框中输入字符时,我已经编写了代码,但接受一个字符控件后,文本框不再出现。 这是我searching`从动态创建的表中搜索数据
<script type="text/javascript">
$(document).ready(function()
{
var minlength = 1;
$("#searchTerm").keyup(function() {
value = $(this).val();
\t \t
\t \t if (value.length > minlength)
\t \t {
\t \t \t searchTable(value);
\t \t }
\t \t else if(value.length < minlength)
\t \t {
\t \t \t searchTable("");
\t \t } \t
\t });
});
function searchTable(value)
{
\t $.ajax({
\t \t type: "GET",
\t \t url: "dispatient.php",
\t \t data:({search_keyword: value}),
\t \t success: function(success)
\t \t {
\t \t \t window.location.href = "dispatient.php?search_keyword="+value; \t
\t \t \t $("#searchTerm").focus();
\t \t },
\t \t error: function()
\t \t {
\t \t \t alert("Error occured.please try again"); \t
\t \t },
\t \t complete: function(complete)
\t \t {
\t \t \t $("#searchTerm").focus();
\t \t },
\t \t
\t });
}
<input id="searchTerm" Type="text" class="search_box" placeholder="Search"
\t \t \t value = <?php echo $_GET['search_keyword'] ?> >
` 请建议我代码..
在此先感谢..
没点。 – EternalHour 2015-03-03 07:01:45