Maybe I'm missing it but I don't see a foreach loop. The error is not a Datatables issue. Sounds like you need to add a check for an empty data set and handle it appropriately.
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Answers
What error do you get?
What is the JSON response when there is no data?
Kevin
Undefined variable sales.
my variable sale on my foreach for the datables data
Maybe I'm missing it but I don't see a foreach loop. The error is not a Datatables issue. Sounds like you need to add a check for an empty data set and handle it appropriately.
Kevin
i did not include the foreach loop on the screenshot here is my foreach![](https://datatables.net/forums/uploads/editor/w5/hbpqlz0mefjc.png)
is my url on ajax is correct? url with parameter? or there are other ways to put a parameter there
Coz im getting this error if the datatable is empty![](https://datatables.net/forums/uploads/editor/kl/ntmckmyxvemp.png)
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
its okay now guys thank you, i just change the $sale->client_id to $client->id