Last active
September 14, 2016 07:39
-
-
Save speedupmate/eddadf15541078437b8dc09b490492ec to your computer and use it in GitHub Desktop.
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
// for prototype.js http://api.prototypejs.org/ajax/Ajax/Responders/ | |
// same can be done with http://api.jquery.com/Ajax_Events/ | |
Ajax.Responders.register({ | |
onCreate: function(obj){ | |
//listen all ajax calls | |
if(obj.parameters.something) { | |
//find your ajax call from the haystack of all calls, by url or by some param whatever fits | |
if(obj.parameters.something === 'your condition'){ | |
if(your.elements){ | |
var names = your.elements.pluck('name'); | |
var values = your.elements.pluck('value'); | |
for(var x=0; x < names.length; x++) { | |
obj.parameters[names[x]] = values[x]; | |
} | |
obj.options.postBody = Object.toQueryString(obj.parameters); | |
} | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment