Why does dom not sync after jquery ajax call and update?

I have a table that uses inline editing with ajax to change fields. The table is sorted by last name.

If I change my last name to reorder the rows and then refresh the page, the table will be reordered, but the field I changed still has the previous value in dom. The input field has the correct value in html, but the dom value is displayed.

A hard update, of course, displays all the correct values.

Why is my DOM not synchronized? How can I get an update to display the correct value?


Edit after replies

It was Firefox that retained the previous value for the input fields. After I poked on the Internet, I found that adding <form autocomplete="off">would cause Firefox to not cache the old value.

+3
source share
2 answers

Most likely, your browser saves the form values โ€‹โ€‹through the update. Is it possible for you to arrange it so that when you upgrade, the trigger that you use to update the DOM from the input field starts up again?

It is difficult to give more detailed information without knowing how your DOM and your input fields interact in the code.

+2
source

, ( ). , , , , value ( ).

, ajax, / .

, , .

, , ...

, (ajax , ), , , , js script, value, :

$("table :input").each(
     $(this).value($(this.attr("value")));
);
+2

Source: https://habr.com/ru/post/1719095/


All Articles