Module ID's using javascript

lalit_parashar
Community Novice

Hi, 

Can some one please help me with fetching the module id's and their start date using javascript?  I would like to use this data for activating and deactivating some links in canvas course. 

I'm using the below code to fetch data but its providing me only course id. 

if (/^\/courses\/\d+.*/.test(window.location.pathname)) {
$.getJSON(`/api/v1/courses/${ENV.COURSE_ID}`, function(r) {

      setInterval(function(){
            var start = new Date(r.start_at);
            var today = new Date();


         if(start <= today){

            console.log("Hello");
         }
}, 100);

})

}