With the rapid development of information technology, online learning of legal specialty in the era of artificial intelligence has become a significant trend. This study explores the pedagogical reform path of integrating course ideology into online learning for law majors. Multiple linear regression models and Apriori association rule algorithms were used to analyze the learning effects of 457 law students. The integration of the course Civics and Politics significantly impacted students’ learning outcomes, especially showing significant differences among students of different genders and grades. Different genders showed significant differences (p<0.05) in course teaching integration and faculty. Significant differences were also observed among students of various grades regarding integration of course materials, teaching, and teacher team integration. The Pearson product-difference correlation analysis of the variables of course civics integration into law teaching found that talent cultivation goal integration, course textbook integration, course teaching integration, and teacher team had significant positive correlations with learning outcomes. These findings were further validated by the association rules mined by the Apriori algorithm. The student learning outcomes are more likely to achieve excellence when the scores for course material integration and teaching integration are high. This study provides an effective pedagogical reform path for integrating civics into online learning for law majors, which significantly enhances students’ learning effects.