Display course title breadcrumbs

baxl
Community Contributor

I have a question and I'm hoping someone could lend some advice.  We have some code to display the course title in the breadcrumbs and course term and course code above the course menu.  Now when on user's details page in a course, it no longer works.  Here's the code:

$(document).ready(function() {
 
  if ($("body").attr("class").match(/\bcontext-course_(.[0-9]*)/)) {
 
     //insert course ID into variable
      var courseID = $("body").attr("class").match(/\bcontext-course_(.[0-9]*)/)[1];
   

        $.getJSON("/api/v1/courses/" + courseID, "include[]=term", function(data) {
         
          $("#breadcrumbs ul li:nth-child(2) a span.ellipsible").html(data.name);
          $('#section-tabs-header-subtitle.ellipsis').html(data.term.name + '<br>' + data.course_code);

        }); //end get jSON     

    }//end check if it is a course
});//end on document ready

I'm stumped as to why it's not triggering on a user's details page when in a course and I really want that a-ha! moment.    

Labels (1)
0 Likes