Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('button.add_account').on('click', function () {
- var date = moment().format('YYYY-MM-DD');
- var time = moment().format('H:mm');
- var username = $('.username').empty().val();
- var password = $('.password').empty().val();
- var phone = $('.phone').empty().val();
- var email = $('.email').empty().val();
- var level = $('select.level').val();
- if (username.length !==0 || password.length !==0 || phone.length !==0|| email.length !==0|| level.length !==0) {
- swal
- ({
- text: "فضلا إنتظر",
- icon: "info",
- button: null
- });
- $.post("/add_new_account/",
- {
- username: username,
- password: password,
- level: level[0],
- phone: phone,
- email: email,
- date: date,
- time: time
- })
- .done(function (response) {
- if (response == "0")
- {
- swal({
- text: "تم إضافة الحساب بنجاح",
- icon: "success",
- button: null,
- timer: 3000
- });
- }
- else if (response == "1")
- {
- swal({
- text: "بيانات الحساب موجودة مسبقا",
- icon: "error",
- button: null,
- timer: 3000
- });
- }
- else
- {
- swal({
- text: "حدث خطأ مفاجئ",
- icon: "warning",
- button: null,
- timer: 3000
- });
- }
- return false;
- })
- }
- else
- {
- swal({
- text: "فضلا إملئ جميع الحقول",
- icon: "warning",
- button: null,
- timer: 3000
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement