I receive the data, but the table does not appear, nor does the "Post" request. Do you have any idea
I receive the data, but the table does not appear, nor does the "Post" request. Do you have any idea
Alexyno8
Posts: 6Questions: 1Answers: 0
I will attach images from two projects. The one on the left is a test (which works), and the one on the right is the main project, which does not work.
I used yajra datatables laravel package.
Thank you!
https://i.imgur.com/6HhB9M1.png
https://i.imgur.com/VTVsH56.png
https://i.imgur.com/QaswB6z.png
https://i.imgur.com/CbCelzJ.png
https://i.imgur.com/1sgeKfy.png
This discussion has been closed.
Answers
Thats a lot of code to dig through. Plus screenshots are very difficult to look at. Can you narrow down the problem a bit and just post the text code you are asking about? Make sure to use the triple back ticks to format your code, see the markdown technote for more info. Even better is posting a link to the page that is not working so we can take a look.
Do you get any errors in your browser's console?
Kevin
https://i.imgur.com/yLUwmmK.png - Data recived
Kevin asked you to post some code - not another screen shot - or preferably a link to a page showing the problem.
He also asked if you are getting errors in your browser's console.
Dealing with the responses you are getting is the best way to get help.
Sure!
Route:
Controller:
View:
Error from console:
Thank You!
When you say the POST request doesn't appear, are you saying the server doesn't receive the request from
serverSide
? Or does the server respond but the client doesn't receive the response?Colin
Is
console.log('x');
outputting properly?Does
url: '{{ route('order-all') }}',
create a valid URL? Do you see a post if you hard code a URL, for example:url: 'myURL',` where myURL is a valid path to your server script?
Kevin
There is no output for console log.
Also, if I comment on this part of code:
I don't know how, but the data is still sent in that form.I think the problem is ajax, but I can't figure out what it is.
I changed the url :
url: '/orders/list',
, the result is the sameIf
console.log('x');
isn't being displayed then there is something causing the<script>
section to not run. Maybe there is a syntax error in your generated page. Try viewing the generated source page and validating it using W3C Validator.Kevin
I'm not familiar with Laravel but this section of code doesn't look right:
Kevin
This part of code is just a comment. I haven't been able to find a solution yet..
Can you post a link to your page so we can take a look?
Did you try the W3C Validator?
If the
console.log('x');
is not being output then I would say its not a Datatables issue but something else with the page.Kevin
I solved the problem.
Wrong:
Route::get('/list', 'OrderController@readOrder')->name('orders_list');
Route::post('order-all', ['as'=>'order-all', 'uses'=>"OrderController@readOrder"])->name('order-all');
Correct :
The problem is that we call the same method from the controller. I had to return a view first.
Thank you for your help and your time!
Thank you, Kevin!