Last active
August 30, 2015 06:45
-
-
Save shamsbd71/adbc9cdb9e3bbf2b4c61 to your computer and use it in GitHub Desktop.
Joomla Ajax Form Submit from Module. help link:https://github.com/Joomla-Ajax-Interface
This file contains 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
/** | |
* @package Custom use | |
* @author Abu Huraira Bin Aman shams.bd71@gmail.com | |
* @license GNU General Public License version 3 or later; see LICENSE.txt | |
* @version 1.0.0 | |
*/ | |
(function($){ | |
$(document).ready(function(){ | |
$('#myform').submit(function() { | |
var value = $(this).serializeArray(), | |
$.ajax({ | |
type : 'POST', | |
data : value, | |
beforeSend: function(){ | |
$('#myform .submit').addClass('loading'); | |
}, | |
success: function (response) { | |
$('#myform .message').fadeOut().html(response).fadeIn().delay(1000); | |
$('#myform .submit').removeClass('loading'); | |
} | |
}); | |
return false; | |
}); | |
}); | |
})(jQuery); |
This file contains 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
<?php | |
/** | |
* @package Custom use | |
* @author Abu Huraira Bin Aman shams.bd71@gmail.com | |
* @license GNU General Public License version 3 or later; see LICENSE.txt | |
* @version 1.0.0 | |
*/ | |
// no direct access | |
defined( '_JEXEC' ) or die( 'Restricted access' ); | |
?> | |
<form id="myform" name="myform"> | |
<button type="submit" class="submit">Submit</button> | |
<div class="message"></div> | |
<input type="hidden" name="option" value="com_ajax" /> | |
<input type="hidden" name="module" value="xpertcontact" /> | |
<input type="hidden" name="format" value="raw" /> | |
<?php echo JHtml::_('form.token'); ?> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment