Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var request;
- $('.addEntry').submit(function (event) {
- if(validateBookYear() && validateBookAuthor() && validateBookName()) {
- var serializedData = $(this).serialize();
- if (request) {
- request.abort();
- }
- request = $.ajax({
- url: "addBook.php",
- type: "POST",
- data: serializedData
- });
- request.done(function (response, textStatus, jqXHR) {
- console.log("sucess");
- });
- request.fail(function (jqXHR, textStatus, errorThrown) {
- console.error(
- "error: " +
- textStatus, errorThrown
- );
- });
- }
- return false;
- });
Advertisement
Add Comment
Please, Sign In to add comment