mardi 26 septembre 2017

ajax in laravel -post menthod not allowed (405 error)

I want to get the value in ajax response to populate the value in select box I have fetched the field value and send to other page using ajax.In console I caught POST http://localhost/pject_name/public/ajaxteach 405 (Method Not Allowed)but When I the url in network it prints 'test connection'.How to get response in ajax call

$('#name-first').on('change',function(){
          dataString=$('#name-first').val();
        $.ajax({
                type: "POST",
                url : "",
                data : dataString,
                success : function(data){
                    console.log(data);
                },error: function () {
             alert('Erreur. Veuillez réessayer.');
          } 
      });
     });
route
  Route::get('/ajaxteach', array(
   'as' => 'ajaxteach',
   'uses' => 'assetRequestController@getproject'
  ) );
controller
public function getproject(Request $request){
print_r($request->dataString);
     echo 'test connection';
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2wTi7wb
via IFTTT

Aucun commentaire:

Enregistrer un commentaire