Created
March 19, 2015 01:56
-
-
Save modemlooper/6a6f8c15536c916da40f to your computer and use it in GitHub Desktop.
ajaxComplete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery( document ).ajaxComplete( function( evt, xhr, options ) { | |
| var action = get_var_in_query( 'action', options.data ) ; | |
| //switch | |
| switch( action ){ | |
| case 'post_update': | |
| console.log('Activity was posted'); | |
| break; | |
| } | |
| }); | |
| function get_var_in_query( item, str ){ | |
| var items; | |
| if( !str ) | |
| return false; | |
| var data_fields = str.split('&'); | |
| for( var i=0; i< data_fields.length; i++ ){ | |
| items = data_fields[i].split('='); | |
| if( items[0] == item ) | |
| return items[1]; | |
| } | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment