document.getElementById("my-submit").addEventListener("click", function () {
submit_from("my-form", function (data) {
console.log(data);
});
});
function submit_from(form_id, callback) {
$.ajax({
url: form.getAttribute("action"),
method: form.getAttribute("method"),
data: jSerialize(form),
success: callback
});
}