0
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."
你檢查你的錯誤添加響應日誌?錯誤日誌和訪問日誌中有什麼? – Jpsh
你能告訴我在哪裏可以看到嗎? –
storage/logs/laravel.log – manniL