I need to pass 4 variables to controller so that I can do what I want to do with it, however I get an error:
Missing argument 1 for App\Http\Controllers\ProfileController::getGoogle()
Here's my Controller:
function getGoogle($lat, $lng, $destinationLat, $destinationLng) {
print_r($lat);
print_r($lng);
print_r($destinationLat);
print_r($destinationLng);
}
and ajax:
function getDirections(lat, lng, destinationLat, destinationLng) {
$.ajax({
url: '/google/',
type: 'post',
data: { lat: lat, lng: lng, destinationLat: destinationLat, destinationLng: destinationLng },
dataType: 'json',
success: function() { alert('hello!'); },
error: function() { alert('boo!'); },
headers: {
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
}
});
Route:
Route::post('google/', 'ProfileController@getGoogle');
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2u1BWRq
via IFTTT
Aucun commentaire:
Enregistrer un commentaire