ajax在laravel中获取请求时发生500内部服务器错误?

问题描述:

in route fileajax在laravel中获取请求时发生500内部服务器错误?

Route::get('griev_reg_form/assembly/{district_id}', '[email protected]'); 

In controller

public function assembly($id){ 
    $assemblyConstituency = AssemblyConstituency::where('dis_code', '=', $id)->orderBy(3)->get(); 
     $options = array(); 

     foreach ($assemblyConstituency as $assembly) { 
      $options += array($assembly->ac_code => $assembly->ac_name); 
     } 

     return Response::json($options); 
    } 

鉴于文件

$("#district").change(function() { 
      $.getJSON("griev_reg_form/assembly/" + $("#district").val(), function(data) { 
       var $assembly = $("#ac_problem"); 
       $assembly.empty(); 
       $.each(data, function(index, value) { 
        $assembly.append('<option value="' + index +'">' + value + '</option>'); 
       }); 
      // $("#station_id").trigger("change"); /* trigger next drop down list not in the example */ 
      }); 
     }); 

when i change the select box there is error name "HTTP500: SERVER ERROR - The server encountered an unexpected condition that prevented it from fulfilling the request."

+0

你检查你的错误添加响应日志?错误日志和访问日志中有什么? – Jpsh

+0

你能告诉我在哪里可以看到吗? –

+0

storage/logs/laravel.log – manniL

这是因为我没有在控制器

use Response;