Form Widget
- added public js code to handle validation and ajax submit - added widget initializer - added form widget - added acceptance test for adding the widget
This commit is contained in:
@ -1,8 +1,22 @@
|
||||
define('public', ['jquery'], function(jQuery) {
|
||||
jQuery(function($) {
|
||||
// dom ready
|
||||
$(function() {
|
||||
define('public', ['jquery', 'jquery-validation'],
|
||||
function($) {
|
||||
|
||||
function isSameDomain(url) {
|
||||
var link = document.createElement('a');
|
||||
link.href = url;
|
||||
return (window.location.hostname === link.hostname);
|
||||
}
|
||||
|
||||
$(function() {
|
||||
// setup form validation
|
||||
$('form.mailpoet_form').validate({
|
||||
submitHandler: function(form) {
|
||||
console.log(form);
|
||||
$(form).ajaxSubmit({
|
||||
target: "#result"
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user