staff, mno, clients, bug fixes
This commit is contained in:
56
public/assets/js/mnos.js
vendored
Normal file
56
public/assets/js/mnos.js
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
$('#addIpBtn').click(function(evt){
|
||||
|
||||
evt.preventDefault();
|
||||
console.log('heere');
|
||||
|
||||
$('#newIpModal').modal('show');
|
||||
});
|
||||
|
||||
|
||||
$('#newIpForm').submit(function(evt){
|
||||
evt.preventDefault();
|
||||
var formData = new FormData($(this)[0]);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: base_url + '/mnos/ip_store',
|
||||
data : formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
async: false,
|
||||
success: function (data){
|
||||
if (data.code === 1) {
|
||||
$("#newIpForm")[0].reset();
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: 'IP Address added successfully',
|
||||
});
|
||||
setTimeout(function(){
|
||||
location.reload();
|
||||
}, 5000);
|
||||
}
|
||||
else if (data.code > 5) {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: data.msg,
|
||||
});
|
||||
}
|
||||
else {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: 'Your request could not be handled. Try again !',
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
error: function(error){
|
||||
var output = $.parseJSON(error.responseText);
|
||||
console.log(output.errors);
|
||||
$('#ipNotifyArea').removeClass('hidden');
|
||||
$('#ipNotifyArea').addClass('alert alert-danger');
|
||||
$.each(output.errors, function (key, value) {
|
||||
console.log(value[0]);
|
||||
$('#ipNotifyArea').text(value[0]);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user