| Conditions | 2 |
| Paths | 3 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | /** global: GLSR, jQuery */ |
||
| 20 | postFromEvent: function( ev, request, callback ) { // Event, object, function|void |
||
| 21 | ev.preventDefault(); |
||
| 22 | var el = x( ev.target ); |
||
| 23 | if( el.is( ':disabled' ))return; |
||
| 24 | request.nonce = request.nonce || el.closest( 'form' ).find( '#_wpnonce' ).val(); |
||
| 25 | var data = { |
||
| 26 | action: GLSR.action, |
||
| 27 | request: request, |
||
| 28 | }; |
||
| 29 | el.prop( 'disabled', true ); |
||
| 30 | x.post( GLSR.ajaxurl, data, function( response ) { |
||
| 31 | if( typeof callback === 'function' ) { |
||
| 32 | callback( response ); |
||
| 33 | } |
||
| 34 | el.prop( 'disabled', false ); |
||
| 35 | }); |
||
| 36 | }, |
||
| 37 | }; |
||
| 39 |