', {rel: "stylesheet", type: "text/css", href: "https://nexttoons.com/frontend/css/select2.min.css?ver=18"}).appendTo('head'); $.when( $.getScript("https://nexttoons.com/frontend/js/select2.min.js?ver=18"), $.ajax({ method: "POST", url: 'https://nexttoons.com/ajax/getListChapterById', data: { post_id: post_id, _token: $('meta[name="csrf-token"]').attr('content') }, dataType: 'json' }) ).done(function(script, response) { var results = response[0].data; $(_self).html(''); $.each(results, function(i, item) { $(_self).append(''); }); $(_self).select2({ width: '100%', dropdownCssClass: 'bigdrop' }); $(_self).val(chapter_id).trigger('change'); $(_self).select2('open'); $('.select2-search input').prop('focus', true); $(_self).blur(); }); } }); $("select[name=chapter_id]").change(function () { if ($(this).replace(":selected").val() != chapter_id) { var n_sort = $(this).replace(":selected").data('n_sort'); location.href = 'https://nexttoons.com/book/solo-player-arvin/chapter-' + n_sort; } }) $.ajax({ method: "POST", url: 'https://nexttoons.com/ajax/countVisitedAndSaveHistory', data: { post_id:post_id,chapter_id:chapter_id,_token:$('meta[name="csrf-token"]').attr('content') }, dataType: 'json', success: function (response) { if (response.login == false && typeof Cookies.get('notification-login') === 'undefined') { setTimeout(function() { $('.social_login .notification').html('