Changeset 38587
- Timestamp:
- 09/11/2016 05:04:39 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/customize-preview.js
r37700 r38587 68 68 69 69 // You cannot submit forms. 70 // @todo: Allow form submissions by mixing $_POST data with the customize setting $_POST data.71 70 this.body.on( 'submit.preview', 'form', function( event ) { 71 var urlParser; 72 73 /* 74 * If the default wasn't prevented already (in which case the form 75 * submission is already being handled by JS), and if it has a GET 76 * request method, then take the serialized form data and add it as 77 * a query string to the action URL and send this in a url message 78 * to the Customizer pane so that it will be loaded. If the form's 79 * action points to a non-previewable URL, the the Customizer pane's 80 * previewUrl setter will reject it so that the form submission is 81 * a no-op, which is the same behavior as when clicking a link to an 82 * external site in the preview. 83 */ 84 if ( ! event.isDefaultPrevented() && 'GET' === this.method.toUpperCase() ) { 85 urlParser = document.createElement( 'a' ); 86 urlParser.href = this.action; 87 if ( urlParser.search.substr( 1 ).length > 1 ) { 88 urlParser.search += '&'; 89 } 90 urlParser.search += $( this ).serialize(); 91 api.preview.send( 'url', urlParser.href ); 92 } 93 72 94 event.preventDefault(); 73 95 });
Note: See TracChangeset
for help on using the changeset viewer.