路线:
路线::得到(' API /获取市场列表',' MemberTradesController @ getMarketList&#39);
路线::得到(' API /获取市场-list1的',' MemberTradesController @ getMarketListtest&#39);
控制器:
public function getMarketListtest(Request $request){
$markets = DB::table("markets")
->pluck("market","id");
return response() -> json($markets);
}
public function getMarketList(Request $request){
$markets = DB::table("markets")
->where("exchange_id", $request->exchange_id)
->pluck("market","id");
return response() -> json($markets);
}
<title>Laravel 5 - Dynamic autocomplete search using select2 JS Ajax</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script type="text/javascript">
$('#exchange').change(function(){
var exchangeID = $(this).val();
if(exchangeID){
$.ajax({
type:"GET",
url:"{{url('api/get-market-list')}}?exchange_id="+exchangeID,
success:function(res){
if(res){
$("#market").empty();
$("#market").append('<option>Select</option>');
$.each(res,function(key,value){
$("#market").append('<option value="'+key+'">'+value+'</option>');
});
}else{
$("#market").empty();
}
}
});
}else{
$("#market").empty();
$("#symbol").empty();
}
});
</script>
&#13;
http://www.yourtradelog.com/api/get-market-list1
URL下面的没有提取数据所以..我的javascript没有给我结果 http://www.yourtradelog.com/api/get-market-list?exchange_id=+1(不工作) 我想知道为什么这不是服务器上的问题但是在localhost中工作正常
**
错误日志
答案 0 :(得分:0)
我刚测试了您提供的链接,这是我对情况的看法:
composer update
编辑:既然你说它适用于localhost,你是否已经成功地将它部署在制作上或只是复制面食?注意您的.env文件和文件权限