wait for successful ajax call
This commit is contained in:
parent
3d97d362b5
commit
dbf23baa45
@ -19,22 +19,24 @@ $.fn.bookmarktable = function() {
|
|||||||
if (!$input) return;
|
if (!$input) return;
|
||||||
|
|
||||||
$input.val($cell.data('value') || html);
|
$input.val($cell.data('value') || html);
|
||||||
|
$input.prop('disabled', false);
|
||||||
$cell.html($input);
|
$cell.html($input);
|
||||||
$input.focus();
|
$input.focus();
|
||||||
|
|
||||||
var submit = function() {
|
var submit = function() {
|
||||||
|
$input.prop('disabled', true);
|
||||||
$.ajax(document.location.href + "/" + $row.data('id'), {
|
$.ajax(document.location.href + "/" + $row.data('id'), {
|
||||||
data: JSON.stringify(Object.fromEntries([[$input.prop('name'), $input.val()]])),
|
data: JSON.stringify(Object.fromEntries([[$input.prop('name'), $input.val()]])),
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
});
|
}).then(function(){
|
||||||
|
|
||||||
var $option = $input.find('option:selected')
|
var $option = $input.find('option:selected')
|
||||||
if ($option.length) {
|
if ($option.length) {
|
||||||
$cell.html($option.html());
|
$cell.html($option.html());
|
||||||
} else {
|
} else {
|
||||||
$cell.html($input.val());
|
$cell.html($input.val());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$input.on('blur', submit).on('change', submit).on('keyup', function(e){
|
$input.on('blur', submit).on('change', submit).on('keyup', function(e){
|
||||||
|
Loading…
Reference in New Issue
Block a user