Let the action attribute of the form only submit data without jumping to the page

A simple problem was encountered and solved today, so record it.
Not much to say about the code:

		<form action="http://localhost:8080" method="post" enctype="multipart/form-data" accept-charset="utf-8" id="myForm" target="nm_iframe">
			<input type="file" name="file" id="file" />
			<input type="submit" id="mySub" />
		</form>
		
		<iframe id="id_iframe" name="nm_iframe" style="display:none;"></iframe>

Pro-test is valid. The key to this piece of code is target="nm_iframe" and the iframe tag below. The jumped data will be output in the iframe tag below. Setting the display none effect will become a non-jumping webpage submission data.

Guess you like

Origin blog.csdn.net/qq_43511063/article/details/108897992