php - Internal Server Error Ajax request on Laravel 5.2.10 project -


i'm working on laravel 5.2.10 project, trying fetch data via ajax i'm getting 500 error, , can't find i'm missing out.

this part of routes.php

route::group(['middleware' => 'web'], function () {     route::auth();     route::get('/home', 'homecontroller@index');     route::get('/videos', 'videoscontroller@index');     route::post('/videos/fetch', array('before' => 'ajax_check'), 'ajaxcontroller@postfetch'); }); 

on 'ajaxcontroller.php' i've got function

public function postfetch() {     //process data , come $data     return view('videos')->with('video_data', $data); } 

and js ajax call

var request = $.ajax({     url: "/videos/fetch",     method: "post",     data: { url : url } });  request.fail(function( jqxhr, textstatus ) {     alert( "request failed: " + textstatus ); }); 

methodnotallowedhttpexception in routecollection.php line 219: in routecollection.php line 219 @ routecollection->methodnotallowed(array('post')) in routecollection.php line 206 @ routecollection->getrouteformethods(object(request), array('post')) in routecollection.php line 158

the methodnotallowed exception hints post route isn't being picked up. format of post route looks little odd me. should in following format

route::post('videos/fetch', array( 'before' => 'ajax_check', 'uses' => 'ajaxcontroller@postfetch' ));


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -