Topic: Datatables generated by javascript do not update with Ajax

buzzman priority asked 10 months ago

Using the sample data and datatable code in MDB where the table data is updated using javascript, it seems that an ajax call to this file contents (get_relevent_datatable.html) to update a div in an Index.html file does not work more than 1x. It works only on the first load. It will however not update a second time.. Using the same data, but hardcoding the tables in the (get_relevent_datatable.html) file will allow me to make multiple ajax calls and work properly.

Is there a trick to making datatables work when populated with javascript and fetched by ajax to update a portion of an index.html file?

link to get_relevent_datatable.html

link to get the index.html file.

Thank you Denis

Mateusz Lazaru staff commented 10 months ago

Hi, I need some more details to better understand the problem.

  1. Shouldn't the ajax method be GET?
  2. What is the expected response? It seems like it's all the HTML from the get_relevent_datatable.html, which doesn't seem to be reasonable.

buzzman priority commented 10 months ago

Thank you for the response. The GET method returns the same results. The expected response is that an updated table is returned. It works the first time, but subsequent updates do not work. Yes it is all that is returned from get_relevent_datatable.html in that file it just runs a query and returns the table. But in the example its just the same table filled by javascript.

buzzman priority answered 10 months ago

I got it. Thank you. I should only pass along the JSON and update it within.

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 6.4.0
  • Device: Desktop
  • Browser: Any
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes