How to change the form handler?

Hello, with the scripts and how they work, I don't know, I can only understand the principle and know how it will be correct to change.
In General, to place multiple forms on the page, advised to get away from id and go through classes.
Found code working ajax forms on:
$(document).ready(function () {
 $("form").submit(function () {
 // Get the form ID
 var formID = $(this).attr('id');
 // Add the grid to the name ID
 var formNm = $('#' + formID);
$.ajax({
 type: "POST",
 url: 'mail.php',
 data: formNm.serialize(),
 success: function (data) {
 // Text output of the result of sending
$(formNm).html(data);
},
 error: function (jqXHR, text, error) {
 // Output error text send
$(formNm).html(error);
}
});
 return false;
});
});


Not going to write masses of text that I then think to change, just , if not difficult, help to modify this script to process the form on a specific class, not by id.
I have some forms, they are all the same.
July 2nd 19 at 17:44
2 answers
July 2nd 19 at 17:46
I am suffering with a similar problem, the author found a solution???
July 2nd 19 at 17:48
you need to change in html and in js it is not necessary what to touch, if you need html in several forms then just change the data-remodal-id="iPhone 6s" that's the solution

Find more questions by tags AJAXJavaScript