I am trying to post some data into laravel controller using jquery ajax, but it shows error
"1/1 NotFoundHttpException in Controller.php line 268: Controller method not found."
and in console is throws
"NetworkError: 404 Not Found "
here is my code below:
in routes.php
Route::controller('contact', 'ContactController');
Route::post('searchDependency','ContactController@postSearchDependency');
ContactController.php
public function postSearchDependency(){
//dd('hello');
}
ajax into index.blade.php
$('#deleteRecord').click(function(){
var total = $('input[class="ids"]:checkbox:checked').length;
var ContactId=[];
$('input[class="ids"]:checked').each(function() {
ContactId.push($(this).val());
});
//alert(ContactId);
$.ajax({
type: 'POST',
data: 'contactId: ContactId',
url: '<?php echo URL::to('contact/searchDependency')?>',
success: function(contacts){
}
});
});
i already posted data using ajax to different method of another controller successfully this way, i already tried the possible solutions, but don't know what happens in this case, please anyone helps me out.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/22uqBpa
via IFTTT
Aucun commentaire:
Enregistrer un commentaire