Jquery as follows is working to submit the newsletter signup forrm but I can't work out how to handle the two forms on same page, if anyone can help me with my very limited jquery knowledge I would really appreciate it.. thank you:
return $(".form-newsletter").on("submit", function(e) {
var error, inputs, submit, success;
if ($(this).valid()) {
e.preventDefault();
submit = $(this).find(".form-contact-submit");
submit.button("loading");
success = $(this).find(".form-contact-success");
error = $(this).find(".form-contact-error");
inputs = $(this).find("input, textarea");
return $.ajax({
type: "POST",
url: "newsletter.php",
data: $(this).serialize(),
success: function(data) {
if (data === "success") {
success.removeClass("hidden");
error.addClass("hidden");
return inputs.val("");
} else {
error.removeClass("hidden");
return success.addClass("hidden");
}
},
complete: function() {
return submit.button("reset");
}
});
}
});
});