How do I remove the "Submit re-form" on page refresh?

  • 0
    Good day. Wrote the simplest Ajax script. Everything works, but when the page is refreshed (Ctrl + R) this message pops up, even if the button has not been pressed.
    And yes, there is a similar post on this Q & amp; A, and it was asked 9 months ago. I just saw "Nothing in pure JS (I don't like this solution, if it works at all). But why then do many sites use AJAX, and there is no such" setup "as mine?

    An example of a site where a dynamic (incomplete) page refresh is running, there is also no such message when refreshing (the offline button opens an empty window):

    My listing:
    <!doctype html>
    	<link rel="stylesheet" href="/styles.css">
    	<script type="text/javascript" src=""></script>
    		<input type="button" name="butt" value="Кнопка"><br>
    		$('input').on('click', function() {
    			$.ajax("file.php", {
    				accepts: {
    					mydata2: "Это данные POST, переданные мною",
    				success: function() {
    					$("body").append("Была нажата кнопка.<br>")

    	//Файл пустой, он нужен только для проверки вызова ajax события success
    AJAX Vivien Fletcher, Mar 11, 2019

  • 2 Answers
  • 0
    A very strange problem. When I copied the site address, I enter it on a new tab - when the page is refreshed, everything works without problems. I return to the problematic tab, I did not change the address - the problem persists. Maybe Chrome is buggy? Does anyone have a guess?

  • 0
    your php is not needed, it's all on the client i.e. JS

    examine the logic of the example sites, they perform a subsequent redirect

    see here
    Mason Fuentes

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!