Я хочу сделать что-то вроде jQuery.get или ajax или что-то в этом роде. вызовет страницу через Ajax и отправит все входные данные формы contact-us-form.
это мой HTML-вход
Код: Выделить всё
Reason of Enquiry
General Enquiry
Facility Management
Solutions
Corporate & Retail Solutions
Submit
Thank you for your message
Your message has been submitted to our team.
An error occurred while processing your request.
и это мой JS
Код: Выделить всё
function c(t) {
var e = window.getFormData($(t));
$.ajax({
type: $(t).attr("method"),
url: $(t).attr("action"),
contentType: "application/json; charsect=utf-8",
dataType: "json",
data: JSON.stringify(e),
success: function (e) {
null != e && 200 == e.status
? ($(t).attr("data-callback") && pixelTracking(),
$(t).slideUp("fast", function (e) {
$(".success").slideDown("fast");
}))
: ($(t).attr("data-callback") && pixelTracking(),
$(t).slideUp("fast", function (e) {
$(".error-msg").slideDown("fast");
}));
},
});
}
$(".page.contact form").submit(function (e) {
e.preventDefault(),
window.validateForm(this) &&
(c(this),
$(".page.contact form").hide(),
$(".page.contact .success").show());
}),
Подробнее здесь: https://stackoverflow.com/questions/791 ... -with-ajax
Мобильная версия