# learnpress/4.3.8/assets/src/js/utils/iframe-submit.js

LearnPress – WordPress LMS Plugin for Create and Sell Online Courses, version 4.3.8. 28 lines.

- Page: https://pluginprobe.com/plugins/learnpress/4.3.8/code/assets/src/js/utils/iframe-submit.js
- Raw: https://pluginprobe.com/plugins/learnpress/4.3.8/raw/assets/src/js/utils/iframe-submit.js
- Modified: 2026-06-01T03:47:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/learnpress/4.3.8/code/assets/src/js/utils/iframe-submit.js#L10-L20`.

```javascript
let iframeCounter = 1;
const $ = window.jQuery || jQuery;

const IframeSubmit = function( form ) {
	const iframeId = 'ajax-iframe-' + iframeCounter;
	let $iframe = $( 'form[name="' + iframeId + '"]' );

	if ( ! $iframe.length ) {
		$iframe = $( '<iframe />' ).appendTo( document.body ).attr( {
			name: iframeId,
			src: '#',
		} );
	}

	$( form ).on( 'submit', function() {
		const $form = $( form ).clone().appendTo( document.body );

		$form.attr( 'target', iframeId );
		$form.find( '#submit' ).remove();

		return false;
	} );

	iframeCounter++;
};

export default IframeSubmit;

```
