How to load the script when page loaded 

$(document.ready(function()
  {
            // write your script
  });

How to get the  Browser URL  from Javascript 

function getQueryStringArgs()
 {
  //get query string without the initial ?
   var qs = (location.search.length > 0 ? location.search.substring(1) : ""),
  //object to hold data
   args = {},
   //get individual items
   items = qs.length ? qs.split("&") : [],
   item = null,
   name = null,
   value = null,
    //used in for loop
    i = 0,
    len = items.length;
    //assign each item onto the args object
     for (i = 0; i < len; i++)
         {
                   item = items[i].split("=");
                   name = decodeURIComponent(item[0]);
                   value = decodeURIComponent(item[1]);
                   if (name.length)
                       {
                               args[name] = value;
                       }
          }
      return args;
        }



Here  your URl having the  UserId
Example :http:localost:8089/UserId=46576287267&Itemid=78908098

Follow the below steps

var args = getQueryStringArgs();
var Userid=args["UserId"];
var ItemId=args["Itemid"];




1 comment:

Anna Schafer said...

This post is permanently moved at below URLfront end developers