PageSourceSearch

https://schooloflearning99.in/assets/js/front_student.js?1790906193

js schooloflearning99.in collected 2026-10-02 01:57:13 UTC 5,882 bytes, 174 lines download raw bytes

1
2$(document).ready(function () {
3    
4    // Automatically load subcategories for the first category
5    const firstCategory = $('.category-item').first();
6   
7    if (firstCategory.length > 0) {
8        const catId = firstCategory.data('id');
9       
10        firstCategory.addClass('active'); // Optional: highlight selected
11        loadSubcategories(catId);
12         //load popular courses
13       
14        loadPopularCourse(catId);
15        //load all course 
16        //loadAllCourse();
17    }
18
19    // Load subcategories when a category is clicked
20    $('.category-item').on('click', function (e) {
21       e.preventDefault();
22
23        $('.category-item').removeClass('active'); // Optional: remove previous active
24        $(this).addClass('active');
25
26        const catId = $(this).data('id');
27        
28        loadSubcategories(catId);
29        //load popular courses
30       loadPopularCourse(catId);
31    });
32    // On subcategory click (delegated binding)
33    $(document).on('click', '.subcategory-item', function (e) {
34        e.preventDefault();
35        $('.subcategory-item').removeClass('active'); // Remove from all
36        $(this).addClass('active'); // Add to clicked one
37    
38        const subcatId = $(this).data('id');
39        const catId = $('.category-item.active').data('id');
40    
41        console.log('Subcategory ID:', subcatId);
42        console.log('Category ID:', catId);
43    
44        loadPopularCourse(catId, subcatId);
45    });
46
47
48    function loadSubcategories(catId) {
49        $.ajax({
50            url: base_url + "student_controller/FetchSubcategoriesBlogs", // your endpoint
51            method: 'POST',
52            data: { category_id: catId },
53           
54            beforeSend: function() {
55                $('.subcategory-list').html('<p>Loading...</p>');
56            },
57            success: function (res) {
58                if(res){
59                    $('.subcategory-list').html(res);
60                }else{
61                    $('.subcategory-list').html('<p>Failed to load subcategories.</p>');
62                }
63            },
64            error: function () {
65                $('.subcategory-list').html('<p>Failed to load subcategories.</p>');
66            }
67        });
68    }
69    function loadPopularCourse(catId,subcatId='') {
70        
71        $.ajax({
72            url: base_url + "student_controller/FetchAllBlogs", // your endpoint
73            method: 'POST',
74            data: { category_id: catId,subcategory_id :subcatId  },
75            beforeSend: function() {
76                $('.blog-grid').html('<p>Loading...</p>');
77            },
78            success: function (res) {
79                if(res){
80                    $('.blog-grid').html('');
81                    $('.blog-grid').html(res);
82                }else{
83                    $('.blog-grid').html('<p>No blogs found.</p>');
84                }
85            },
86            error: function () {
87                $('.blog-grid').html('<p>Failed to load blogs.</p>');
88            }
89        });
90    }
91    //load all recent courses
92    $('.course_filter').on('click', function (e) {
93       e.preventDefault();
94
95        $('.course_filter').removeClass('active'); // Optional: remove previous active
96        $(this).addClass('active');
97
98        const course_type = $(this).data('id');
99        
100        //load all recent courses
101        loadAllCourse(course_type);
102    });
103     function loadAllCourse(course_type) {
104        $.ajax({
105            url: base_url + "student_controller/FetchAllCourse", // your endpoint
106            method: 'POST',
107            data: { course_type: course_type },
108            beforeSend: function() {
109                $('.recent-courses-grid').html('<p>Loading...</p>');
110            },
111            success: function (res) {
112                if(res){
113                    $('.recent-courses-grid').html('');
114                    $('.recent-courses-grid').html(res);
115                }else{
116                    $('.recent-courses-grid').html('<p>No course found.</p>');
117                }
118            },
119            error: function () {
120                $('.recent-courses-grid').html('<p>Failed to load courses.</p>');
121            }
122        });
123    }
124    
125    //on my course page load all courses category wise
126    
127    const firstMyCategory = $('.filter-pill').first();
128    if (firstMyCategory.length > 0) {
129        const catId = firstMyCategory.data('id');
130        firstMyCategory.addClass('active'); // Optional: highlight selected
131       
132         //load all courses on my course page
133        loadCourseMyCoursePage(catId);
134        
135    }
136    // Load subcategories when a category is clicked
137    $('.filter-pill').on('click', function (e) {
138       e.preventDefault();
139
140        $('.filter-pill').removeClass('active'); // Optional: remove previous active
141        $(this).addClass('active');
142
143        const catId = $(this).data('id');
144        
145        loadCourseMyCoursePage(catId);
146        
147    });
148    
149    function loadCourseMyCoursePage(catId) {
150        $.ajax({
151            url: base_url + "student_controller/FetchMyCourseAll", // your endpoint
152            method: 'POST',
153            data: { category_id: catId  },
154            beforeSend: function() {
155                $('.course-grid-all').html('<p>Loading...</p>');
156            },
157            success: function (res) {
158                if(res){
159                    $('.course-grid-all').html('');
160                    $('.course-grid-all').html(res);
161                }else{
162                    $('.course-grid-all').html('<p>No course found.</p>');
163                }
164            },
165            error: function () {
166                $('.course-grid-all').html('<p>Failed to load courses.</p>');
167            }
168        });
169    }
170    
171    
172      
173});
174

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.