Sharepoint - Get the id value from the page url
you can use SharePoint’s GetUrlKeyValue()
function to get item id. Example:
var itemId = GetUrlKeyValue("ID", false, location.href);
Use the following javascript function :
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var prodId = getParameterByName('prodId');