Changeset 10294
- Timestamp:
- 10/21/2015 06:57:52 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-templates/bp-legacy/js/buddypress.js
r10214 r10294 105 105 var last_date_recorded = 0, 106 106 button = jq(this), 107 form = button.closest('form#whats-new-form'); 108 109 form.children().each( function() { 110 if ( jq.nodeName(this, 'textarea') || jq.nodeName(this, 'input') ) { 107 form = button.closest('form#whats-new-form'), 108 inputs = {}, post_data; 109 110 // Get all inputs and organize them into an object {name: value} 111 jq.each( form.serializeArray(), function( key, input ) { 112 // Only include public extra data 113 if ( '_' !== input.name.substr( 0, 1 ) && 'whats-new' !== input.name.substr( 0, 9 ) ) { 114 if ( ! inputs[ input.name ] ) { 115 inputs[ input.name ] = input.value; 116 } else { 117 // Checkboxes/dropdown list can have multiple selected value 118 if ( ! jq.isArray( inputs[ input.name ] ) ) { 119 inputs[ input.name ] = new Array( inputs[ input.name ], input.value ); 120 } else { 121 inputs[ input.name ].push( input.value ); 122 } 123 } 124 } 125 } ); 126 127 form.find( '*' ).each( function() { 128 if ( jq.nodeName( this, 'textarea' ) || jq.nodeName( this, 'input' ) ) { 111 129 jq(this).prop( 'disabled', true ); 112 130 } 113 } );131 } ); 114 132 115 133 /* Remove any errors */ … … 146 164 } 147 165 148 jq.post( ajaxurl,{166 post_data = jq.extend( { 149 167 action: 'post_update', 150 168 'cookie': bp_get_cookies(), … … 155 173 'since': last_date_recorded, 156 174 '_bp_as_nonce': jq('#_bp_as_nonce').val() || '' 157 }, 158 function(response) { 159 160 form. children().each( function() {161 if ( jq.nodeName( this, 'textarea') || jq.nodeName(this, 'input') ) {175 }, inputs ); 176 177 jq.post( ajaxurl, post_data, function( response ) { 178 form.find( '*' ).each( function() { 179 if ( jq.nodeName( this, 'textarea' ) || jq.nodeName( this, 'input' ) ) { 162 180 jq(this).prop( 'disabled', false ); 163 181 } … … 206 224 jq('li.new-update').removeClass( 'new-update' ); 207 225 jq('#whats-new').val(''); 226 form.get(0).reset(); 208 227 209 228 // reset vars to get newest activities
Note: See TracChangeset
for help on using the changeset viewer.