bootstrap switchで前の値に戻す処理をメモ。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$(document).on('switchChange.bootstrapSwitch', '.switch-button', function(event, state) { // 何か処理してエラーになったら $.ajax( { url: '/xxx/xxx/xxx', type: 'post', dataType : 'json', success: function( data ) { // 成功 }, error: function( data ) { // 失敗したので前の値に戻す $(".switch-button").trigger('previousState.bootstrapSwitch', true); }, complete: function( data ) { } }); } |
ってなる。
One comment to this article
Tony Landherr
on 2016年12月7日 at 8:57 PM -
You’ve made some decent points there. I looked on the web to find out more about the issue and found most individuals will go along with your views on this web site.