I don't know exactly why this happens, here is some of the code:
function submit_edit(url) {
var value = $('#clicked').val();
var staff_ID = $('#staff_id').val();
if (value == 'Delete') {
url = url + '/Delete/' + staff_ID;
alert(url);
myApp.confirm('Are you sure?', 'Delete Staff', function () {
check_url(url);
});
return false;
}
else if (value == 'Submit') {
alert(url);
myApp.confirm('Are you sure?', 'Submit Changes', function (event) {
//event.preventDefault();
check_url(url);
});
return false;
}
else if (value == 'Cancel') {
url = url + '/Cancel';
myApp.confirm('Are you sure?', 'Cancel Changes', function () {
check_url(url);
});
return false;
}
}
The delete
and cancel
statements work. But when I hit submit, it doesn't process the form. Granted the other two don't use any of the checkbox
inputs. The script will work as soon as I turn the return false;
to return true;
, but it will redirect it... which isn't what I want. This is the closest I've gotten so far. You can request extra code if need be, I will supply it. I do appreciate all answers and feedback!
Update
Here is the requested code for the check_url()
function check_url(recieve_url) {
if (recieve_url == undefined || recieve_url == null) {
alert("recieve_url is not set!");
}
$.ajax({
url : recieve_url,
type : 'POST',
dataType : 'json',
success : function (result) {
//alert(result['bg'] + result['message'] + result['caption'])
myApp.alert(result['message'], result['title'], function () {
if (result['redirect'] != null || result['redirect'] != undefined){
window.location = "<?php echo $this->url;?>"+result['redirect'];
}
});
//myApp.alert(result['message'], result['title']);
},
error : function (xhr, ajaxOptions, thrownError) {
myApp.alert(xhr.responseText);
myApp.alert(recieve_url);
myApp.alert(thrownError);
}
})
}