Having issues updating table with Javascript after form submit in IE and Edge browsers

My current setup involves using Contact Form 7 in Wordpress to store data in a MySQL Database with Submit-Form. Now, I am working on reloading a table containing this data after the form submission. Here is the script I am currently using:

/* FORM RELOAD AFTER SUBMIT */
jQuery("form").submit(function() {
    setTimeout(function(){
        jQuery("#table-div").load(document.URL +  ' #table-div > table');
    }, 500);
});

I added a timeout in order to allow time for the data to be saved and retrieved. This method works well in most browsers (FF, Chrome, IE...), but unfortunately does not work in IE and Edge. I have been unable to find a solution for this issue.

Answer №1

To fix the issue, I included jQuery.ajaxSetup({ cache: false }); in my script and now it's functioning correctly. Here is the updated code:

/* RELOAD FORM AFTER SUBMISSION */
jQuery("form").submit(function() {
    setTimeout(function(){
        jQuery("#table-div").load(document.URL + '?1234' + ' #table-div > table');
    }, 500);
});
jQuery.ajaxSetup({ cache: false });

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using Laravel to remove data with an incorrect ID

Whenever I try to delete data using the Delete button, it seems like the data being deleted does not correspond to the rows I intended. Instead, the data at the top of the table gets deleted. For example, when I use return $meja, id 1 shows up instead of ...

MySQL Alert "#1064 - There seems to be an issue..."

Currently, I am utilizing MySQL version 5.6.33. This is the configuration of my table: CREATE TABLE test ( id int(11) NOT NULL AUTO_INCREMENT, a1 varchar(255) NOT NULL, a2 varchar(255) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=u ...

Quiz timer using JavaScript

In my HTML and JavaScript project, I am creating a quiz game where players have 15 seconds to answer each question. To implement this timer feature, I used the following code snippet: <body onload="setTimeout(Timer,15000)"> Implemented in JavaScrip ...

Why is my Cloud Storage Cloud upload file showing a file size of "0 bytes" (Node)?

I am having issues uploading a PDF file to Google Cloud Storage as the file size appears to be 0 bytes. I have been trying to resolve this for the past 3 days but have not received any response. Here is the code snippet that I am using: const cv = req ...

Issue with Bootstrap4 Carousel not scrolling horizontally

I'm currently working on creating a carousel following the Bootstrap code snippet page. It features three images and is designed to have slide controls that move left and right. The script tags with the necessary scripts are located at the bottom of t ...

How can I utilize the Facebook API on Tizen to share a video?

Could someone please provide guidance on how to incorporate video uploading functionality into a Tizen application using the Facebook API and HTML5? ...

Conduct a partial search on a MySQL table even if there is a possibility of finding an exact

Running a SQL statement from a PHP script, like the one below: SELECT PHONE, COALESCE(PREFERREDNAME, POPULARNAME) FROM distilled_contacts WHERE PHONE LIKE :phone LIMIT 6 This query returns the first 6 matches against the specified table. The value bound ...

personalized link when uploading images in Jodit Editor

I recently integrated the Jodit Editor (react) with the Insert Image option, allowing users to upload images that are saved in the default location set by the Editor. Now I am curious about how to use a custom URL to insert an image in the editor. Here i ...

Issues with utilizing Jquery datepicker within a Vue.js component's v-for loop in Laravel

I am facing an issue with the Jquery date picker inside a v-for loop in my vue.js component. The date picker works fine outside of the loop, but inside the loop it does not behave as expected. Here is a snippet of code where the date picker is working cor ...

A guide on combining two native Record types in TypeScript

Is it possible to combine two predefined Record types in TypeScript? Consider the two Records below: var dictionary1 : Record<string, string []> ={ 'fruits' : ['apple','banana', 'cherry'], 'vegeta ...

Encountering an error when setting up a React-TypeScript ContextAPI

I am currently attempting to understand and replicate the functionality of a specific package found at: https://github.com/AlexSegen/react-shopping-cart Working within a React-Typescript project, I have encountered challenges when creating the ProductCont ...

I can't seem to get my script to work, no matter how many different scenarios I try

Having trouble running my CREATE PROCEDURE script as it keeps giving a syntax error. Can someone help me figure out what is wrong? I attempted to remove the ";" in front of END IF in the create procedure and also tried changing the position of END IF CR ...

Tallying the number of words delimited by a comma

Here is how my counter function is structured: function count() { var value = ids.val(); return (value == '') ? 0 : value.replace(/\s,?|,$/g, '').split(',').length; } After checking the returned value, data is ...

JavaScript code for displaying and concealing elements

I have a simple requirement where I need to check for a variable and display or hide a class based on its value. This is being done on a SharePoint publishing page. The snippet below is not working as expected: if (source === 'show') { $(&a ...

Customizing the color of cells in an HTML table within a JSON based on their status

Would you like to learn how to customize the color of cells in an HTML table based on the status of a college semester's course map? The table represents all the necessary courses for your major, with green indicating completed courses, yellow for cou ...

What is the best way to handle multi-dimensional JSON data without keys in JavaScript?

My JSON data is structured as follows: { "bitcoin": [ "-0.47", "-0.46", "-0.42" ], "maker": [ "8.29", "8.29", "6.89" ] } I want to extract values from this data where keys are not specified. How can I achieve this? Update: Tha ...

Error message: The attempted import failed because ' is not exported from the module

I am facing an issue with resolving my problem. In a file named lama.d.ts, I have declared a class using the following code: export declare class lama { // code here } After that, I tried to import this class in another file within the same folder ...

How can I extract the URL from the event listener in Cordova's in-app browser event and then automatically close it once a specific URL is reached?

In my journey with ionic version 1 (just starting out with ionic & angularjs), I encountered an issue while trying to close the in app browser upon reaching a specific URL. The problem arises from the fact that the event triggered on "loadstart" is o ...

Passing a node.js variable to an ejs template through a post request

In my nodejs application, I utilize Express JS to handle post requests. Within the INDEX.JS FILE, the following code snippet is present: this.app.post('/profile', (req, res, next) => { let password = req.bo ...

Vue/Vuex - using async dispatch for AJAX requests in multiple components

I am working with vuex and using a store module to load user lists in my app through ajax. After the list is loaded, it doesn't fetch again if it's already present in the vuex store. I have implemented this logic in the main application layout as ...