class TiktokProfile { constructor(username, followers = 0, likes = 0) { } getData() { console.log('Get data for'); $('.form-check-input').change((event) => { let dataId = $(event.target).val(); //lấy giá trạng thái check hoặc uncheck let value = $(event.target).is(':checked') ? 1 : 0; //Gọi ajax $.ajax({ type: "post", url: "/tiktok/get-data-profile", dataType: "json", data: {'dataId': dataId,value:value}, headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, success: (msg) => { if(msg.success == true){ this.showtoast(msg.message); } }, error: (request, error) => { this.showtoast('Có lỗi xảy ra', 'error'); } });//End ajax }); } showtoast(text, type = 'success') { $.toast({ text: text, // Text that is to be shown in the toast heading: 'Note', // Optional heading to be shown on the toast icon: type, // Type of toast icon showHideTransition: 'fade', // fade, slide or plain allowToastClose: true, // Boolean value true or false hideAfter: 5000, // false to make it sticky or number representing the miliseconds as time after which toast needs to be hidden stack: 10, // false if there should be only one toast at a time or a number representing the maximum number of toasts to be shown at a time position: 'top-center', // bottom-left or bottom-right or bottom-center or top-left or top-right or top-center or mid-center or an object representing the left, right, top, bottom values textAlign: 'left', // Text alignment i.e. left, right or center loader: true, // Whether to show loader or not. True by default loaderBg: '#9EC600', // Background color of the toast loader }); } changeColorLinkTiktok() { $('.tiktok-profile-link').click(function() { $(this).css('color', 'red'); }); } }; $(document).ready(function() { const profile = new TiktokProfile('user123', 100, 500); profile.getData(); profile.changeColorLinkTiktok(); })