What is the ajax call returning? (Developer tools -> network -> response)
Your ajax call is making a get request, which will return
Route::get('/', 'StartController@index');
which isn't returning json
You would need to update your javascript to make a post request or change your ajax route in routes.php to a get request
Thanks for replying, I made a few changes yesterday and managed to get the JSON data returned that i requested, although occasionally on page refresh i see a 500 (internal server error) Error in the console
firstly while testing - i removed the datatype from the ajax call and found i had somehow managed to return a complete html form back to my script lol.
i removed the slash from the ajax call (url:'update',)
then i changed the 2nd Route from POST to GET
Route::get('/','StartController@update');
then in the controller i changed the return to
return json_encode(array('test'=>'Hello'));
which worked - before changing it back to the result from the Test::all();
return $data;
it works but i don't understand the 500 (internal server error)??
This podcast may be helpful to find an answer.
https://laracasts.com/series/learning-vue-step-by-step/episodes/10
musaugurlu said:
This podcast may be helpful to find an answer.
https://laracasts.com/series/learning-vue-step-by-step/episodes/10
Thanks - i missed that one, i tried his syntax substituting my data which give me a 500 (internal server error) every call also he doesn't use the session token in his example.
i had this running in codeigniter within minutes.....
I'm using Xampp for my tests and i have no php errors in the log and the apache log just shows the 500 message - no clues.
Can you post your routes.php, controller and view?
stephansps said:
Thanks for replying, I made a few changes yesterday and managed to get the JSON data returned that i requested, although occasionally on page refresh i see a 500 (internal server error) Error in the console
firstly while testing - i removed the datatype from the ajax call and found i had somehow managed to return a complete html form back to my script lol.
i removed the slash from the ajax call (url:'update',)
then i changed the 2nd Route from POST to GET
Route::get('/','StartController@update');
then in the controller i changed the return to
return json_encode(array('test'=>'Hello'));
which worked - before changing it back to the result from the Test::all();
return $data;
it works but i don't understand the 500 (internal server error)??
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community