thinkphp5 jquery Autocomplete 无法传递额外参数extraParams使用ajax的写法

  $("#id").autocomplete({ 
            source: function(request, response){
                        $.ajax({  
                             type : "GET",
			                 contentType : "application/json;charset=utf-8",
                             url: "__URL__/xx",  
                             dataType: "json",  
                             data:{term:request.term,ar:$('#city').val()},
                             async : false,
                             success: function(result) {  
                                 response(result);
                             }  
                         });     
            },
            select: function(event, ui){   
                    $("#id").val(ui.item.label);
                    return false;  
                }
        }); 
---------------------------------------------------------------------------------------------------------------
thinkphp 后台获取:
         $q = strtolower($_GET["term"]); 
         $ar = strtolower($_GET["ar"]); 

希望能帮助到需要的人,摸索了很久,掉进坑刚出来!

你可能感兴趣的:(jQuery,JavaScript,Ajax)