jQuery Autocomplete (Remote) - example

前端 未结 4 976
栀梦
栀梦 2020-12-16 03:49

I was really hoping to avoid posting a new question, but I cannot find a functioning example of the jQuery Autocomplete Remote feature that includes both the calling page an

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-16 04:26

    I did the php like & it was successful, I was using mysqli method.

        $q = strtolower($_GET["term"]);
    
        $return = array();
        $query = "select name from students where name like '%$q%'";
        $result=$conn->query($query);
                while ($cresult=$result->fetch_row()){array_push($return,array('label'=>$cresult[0],'value'=>$cresult[0]));
        }
        echo(json_encode($return));
    

    ?>

提交回复
热议问题