谁能帮帮我搞定这个Autofill自动填充表格的插件

正常情况下可以自动填充表格内容,但是只要是下拉菜单选择就是始终无法自动填充选择,怎么看规则呢

You should return false if the rollnumber isn't in the database, so to do that you could check if the array is empty or not using count(), replace the following line :

echo json_encode($json, true);
By :

if( count($json) == 0){
echo json_encode("false", true);
}else{
echo json_encode($json, true);
}
Then is your JS code you should add a condition to show "Rollnumber not found" like :

$(document).ready(function(){
$("#loading1").hide();

$("#rollnumber").on('input', function(){
$("#loading1").show();
var id = $(this).val();

$.ajax({
  type: "POST",
  url: "checkrollnumber.php",
  data: {one: id},
  dataType: 'json',
  success: function (data) 
  {
    if (data == 'false') 
    {
        alert("Rollnumber not found");
    }else{
      for (var i = 0; i < data.length; i++) { //for each user in the json response
        $("#fname").val(data[i].fname);
        $("#lname").val(data[i].lname);
        $("#email").val(data[i].email);
        $("#phone").val(data[i].phone);
        $("#batch").val(data[i].batch);
        $("#lclass").val(data[i].lclass);
      } // for

    } // if

    $("#loading1").hide();
  } // success
}); // ajax

});
});
NOTE : The data parameter should be sent like data: {one: id}. I suggest also the use of input as event since it's more efficient when you track the use inputs :

$("#rollnumber").on('input', function(){
Hope it will help you.