Visit Sudirman Saputra at Ping.sg how to get the parameter value from a url? | Gunting Batu Kertas Kendari
Loading...
Thursday, October 10, 2013

how to get the parameter value from a url?

how to get the parameter value from a url?

Here is a easy to read and understand JS function that you can use to retrieve any variable from url.

All you need to do is call this function with name of the variable that you want to filter and it will return the value back to you.

Hope it helps:


function getURLParameter(name) {
                return decodeURI(
                    (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
                );              
            }
            var paramValue = getURLParameter('paramName');
            //alert(paramValue);

NOTE:
  • Replace 'paramName' with parameter for which you are looking to get value.
  • Variable 'paramValue' stores the parameter value.

1 comments:

  1. Casinos Near Casinos Near Casinos in Las Vegas, NV - MapYRO
    Find the best casinos 계룡 출장샵 and 안양 출장마사지 other 동해 출장샵 lodging near casinos in 양주 출장마사지 Las Vegas, 성남 출장마사지 NV. to the Strip or across the street from the Hard Rock Hotel and Casino in Las

    ReplyDelete

 
TOP