Skip to content

Instantly share code, notes, and snippets.

@Pum-purum
Created July 24, 2018 02:38
Show Gist options
  • Save Pum-purum/fc8737649c7598150246d719de5eab7f to your computer and use it in GitHub Desktop.
Save Pum-purum/fc8737649c7598150246d719de5eab7f to your computer and use it in GitHub Desktop.
Bitrix ajax
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