Table not working in mozila and saferi

Am facing a problem with my script. its not working in mozila and saferi browser
it is only working in chrome.

in mozila and saferi table does not belive that data comes from it belongs to it.
but in chrome everything works good. the data comes and treat it as table data. search, filter. everything works ok. ONLY JUST MOZILA AND SAFERI NOT WORKING

i found this problem so popluar on internet that

that if you dont define preventDefault(); mozila and other browser things wont working

alot information out there.
i will be happy to get help

<table id="mydocs">
    <thead>
        <tr>
            <th>Name</th>
			<th>Country</th>
        </tr>
    </thead>
    <tbody id="Results"></tbody>
</table>


<script>
	   $.ajax({
	type: "GET",
	url: "docs.php",
	dataType: "html",
	success: function(data) {
		$('#Results').html(data);
	}
});
</script>
        <script>
            $(document).ready(function () {
                var datatbl = $("#mydocs").DataTable({
                    pagingType: "simple",
                    lengthMenu: [
                        [20, 25, 50, -1],
                        [20, 25, 50, "All"],
                    ],
                    bLengthChange: false
                    
                });
               
            });
        </script>

The markup that is returned by docs.php in the ajax call is probably invalid. Have you checked the browser’s developer tools console tab for errors? What is the code for docs.php?

there is no error in developer tools console even in network no error, docs.php has no problem. if it had problem. it would not work in chrome. even in mozila and saferi it works. but table doesnt treat results that it belongs to table. results just come as normal, but in chrome it works every good

Your code makes absolutely no sense. Why do you create a datatable when you put the fetch response as html in the Dom?

i will be happy to guide me how to do it properly

You could start by reading the datatables manual where you will find also many examples how to setup a datatable.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.