Created
July 24, 2018 02:38
-
-
Save Pum-purum/fc8737649c7598150246d719de5eab7f to your computer and use it in GitHub Desktop.
Bitrix ajax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BX.ready(function (){ | |
BX.bind(BX('bowling_reserve'), 'click', function (e){ | |
e.preventDefault(); | |
var form = this.closest('form'); | |
var formData = BX.ajax.prepareData(BX.ajax.prepareForm(form).data); | |
BX.ajax({ | |
url: '/ajax/bowling_reservation.php', | |
data: formData, | |
method: 'POST', | |
dataType: 'json', | |
timeout: 30, | |
async: true, | |
processData: true, | |
scriptsRunFirst: true, | |
emulateOnload: true, | |
start: true, | |
cache: false, | |
onsuccess: function (data){ | |
console.dir(data); | |
}, | |
onfailure: function (){ | |
console.error(data); | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment