Hi, I just downloaded the plugin and I was playing with it, I think it is great. However I also have a problem, so I'll suggest a new feature:
I want forms to also be sent by POST. For instance: the Edit User Profile page, if using GET the query string is too long. So I have modified the plugin to allow to also work with forms submitting by POST
Basically, I propose:
- Add a new configuration item: "submit form by post class":
var AAPL_form_post_class = '<?php echo get_option('AAPL_form_post_class'); ?>';
- Rename variables and functions:
AAPL_searchPath -> AAPL_formActionPath
submitSearch -> submitForm
- Modify inside AAPL_loadPageInit:
// Added these 2 variables
form_classes = [AAPL_search_class, AAPL_form_post_class];
form_method_requests = ['GET', 'POST'];
// Added this
jQuery(form_classes).each(function(index_class, class_name) {
// Modified here
jQuery('.' + class_name).each(function(index) {
if (jQuery(this).attr("action")) {
jQuery(this).submit(function() {
// This line was moved (it was before jQuery(this))
AAPL_formActionPath = jQuery(this).attr("action");
// Modified here: added param form_method_requests[index_class]
submitForm(jQuery(this).serialize(), form_method_requests[index_class]);
return false;
});
} else {
if (AAPL_warnings == true) {
alert("WARNING: \nSearch form found but attribute 'action' missing!?!?! This may mean search form doesnt work with AAPL!");
}
}
});
// Modified here
if (jQuery('.' + class_name).attr("action")) {} else {
if (AAPL_warnings == true) {
alert("WARNING: \nCould not bind to search form...\nCould not find <form> tag with class='" + class_name + "' or action='' missing. This may mean search form doesnt work with AAPL!");
}
}
});
I have implemented these changes and it works alright. I hope it can be added to a new release :)
Cheers,
Leo
http://wordpress.org/extend/plugins/advanced-ajax-page-loader/