Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('.js-submit').on('click',function(e){
- e.preventDefault();
- var thisForm = $(this).closest('.contentForm');
- var formAction = thisForm.attr('data-action');
- var formMethod = thisForm.attr('data-method');
- var data = thisForm.find("input,select,textarea").serialize()
- $.ajax({
- type: formMethod,
- url: formAction,
- data: data,
- success: function() {
- console.log('success!'); // or not!
- },
- error:function (xhr, ajaxOptions, thrownError){
- console.log(xhr.status); // 0
- console.log(thrownError); // empty
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement