I have a jquery ajax function that updates a rating that is set for a contest and sends that to a controller to change the database var.
But how do I dynamically get the contest id and base url of the website from the url into my jquery function?
http://ontwerpwedstrijden.dev/contests/1
This is the route url I'm working with.
$(function() {
  $(".radio").on("click",function(e) {  
    // dynamic variables
    var base = 'http://ontwerpwedstrijden.dev';
    var id = 1; // needs to be changed to the current url id
    // Ajax call 
    $.post(base+'/contests/'+id,{ rating: this.value}, function(data) {
      console.log(data);
    });
  });  
});
 
     
    