Initialize dynamically created table using ajax

Initialize dynamically created table using ajax

ghalyghaly Posts: 4Questions: 0Answers: 0

I am calling blade view which has the table element, then initialize dataTable on that table.
I did a waiting 2-3 seconds in order for table tag to be created, with no success!

Kindly assist,
http://live.datatables.net/titarano/1/edit

Replies

  • ghalyghaly Posts: 4Questions: 0Answers: 0

    I just found the datatables debugger so I made one from my real script (not the one on live.datatables site).

    https://debug.datatables.net/uraxov

  • allanallan Posts: 61,734Questions: 1Answers: 10,110 Site admin

    If you pop open the console in your browser you'll see an error such as:

    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at ...

    That is the reason it isn't loading. You would either need to have the data source on the same domain as the data being requested, use a proxy or enable CORS at end point.

    Allan

  • ghalyghaly Posts: 4Questions: 0Answers: 0
    edited August 2021

    Thanks @allan , what I posted on datatables-live was an example which has CORS problem.

    But my issues was that I added dataset attributes to <table> tag, which apparently did conflict somewhere.

    So, I did not read that <table> tag can not have attributes more than "class" and "id".

  • allanallan Posts: 61,734Questions: 1Answers: 10,110 Site admin

    So, I did not read that <table> tag can not have attributes more than "class" and "id".

    It can: http://live.datatables.net/jenanuha/1/edit . What attributes were you using that was causing the issue.

    Allan

  • ghalyghaly Posts: 4Questions: 0Answers: 0

    I am using dataset for example data-script, data-whatever
    well it doesn't work as you can see here
    http://live.datatables.net/jenanuha/2/edit

    we need to click run js because I am disabling autoexecute

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,771

    You will be interested to read the Options set by HTML5 data attributes. For example data-ajax is causing the Ajax error.

    Kevin

Sign In or Register to comment.