Good afternoon, I have a problem with the registration form and its validation.

When a user enters mail in a form, the validator checks if the mail is busy, makes a request and receives JSON data from the server via ajax. If the user enters a new mail, the validator will repeat the operation, but if you enter the first mail in the form, then the validator will not ask for anything because he already has this data. The data will be stored until the page is reloaded, and I want to delete this data after the popup closes, because their presence can lead to an error, for example, if the user tries to re-register in the system.

And so the question is how to delete this data after closing the popup. enter image description here

  • json data is no different from other data. In 99% of cases, you just need to assign a variable that stores json or an empty string (if json data as a string), or an empty json. - KoVadim
  • Honestly, the code is not mine, and I do not know where it saves them, I see that the contents can be read in the browser inspector in the Network tab, you can filter by XHR, there you can find all requests received earlier. - FRC_Volen
  • It only means that the browser received them. Did he save them - and who knows - KoVadim
  • If I repeat the conditions under which the browser must re-request data from the server, the browser will see that it already has this data and will not request it again. Those if I lead him to the form Post No. 1, and then post No. 2, the validator will check whether these mailboxes are busy or not, and send data from the server about it, but if I re-enter mail No. 1, the browser will not request this data from the server, he already has them. - FRC_Volen
  • Post a sample code where emails are saved. - Igor Golovin

1 answer 1

The issue was resolved by compulsory data update.

$ .ajax ({actualize: true, ....

The validator now requests a response from the server each time it checks, even if it has already checked these values ​​and has the correct response from the server for a similar request.

those. in spite of the fact that the validator already has data for this request, it will still re-request the data again every time it is checked, and this actually fixes the bug with non-relevant data stored in the browser in the future.

  • The answer is terrible. You did not answer the question. From this answer is not clear anything! - hedgehogues
  • I renewed. The essence of the decision is that the validator does not check the already existing responses from the server, but requests for each case again, even if it has already requested this data from the server - FRC_Volen
  • The answer is still terrible. At least this is $.ajax({ actualize: true,.... - hedgehogues
  • In fact, this was the only change in the code, as I had not previously laid out the code, I explained the essence of the change with the text above - FRC_Volen