Skip to content

Instantly share code, notes, and snippets.

@thanhtunguet
Created November 27, 2018 17:41
Show Gist options
  • Save thanhtunguet/94f94728863fb489b4786cd23128eea7 to your computer and use it in GitHub Desktop.
Save thanhtunguet/94f94728863fb489b4786cd23128eea7 to your computer and use it in GitHub Desktop.
const regist = function (code) {
$.ajax({
type: 'POST',
url: `/chon-mon-hoc/${code}/1/2`,
success: (a, b) => {
commit(code);
},
error: (a, b) => {
commit(code);
},
});
};
const commit = function (code) {
$.ajax({
type: 'POST',
url: '/xac-nhan-dang-ky/1',
success: (a, b) => {
try {
let t = Number.parseInt(
a.message.split('Đăng ký thành công ')[1]
.split(' ')[0]
);
if (t != end) {
regist(code);
} else {
confirm('success');
}
} catch (e) {
regist(code);
}
},
error: function (a, b) {
regist(code);
}
})
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment