NOTE: Just to let you know, you're URL formatting is also incorrect.
Your URL is http://crm//WebResources/abaxis_popup?Data=recordid%3dElectrolyte
Which translates to http://crm//WebResources/abaxis_popup?Data=recordid=Electrolyte
The double =
's after recordid is breaking your GET parameters.
So the Data
param is being set to recordid
before anything else happens. Not sure what you want to do here.
In order to remove this from the URL string you could use the following :
urlString = urlString.replace(/Data=/g, '');
As suggested you are posting a duplicate question with a slight difference in HTML URL format.
You have HTML chars instead of regular strings.
So convert them back.
Our string URL
var urlString = "http://crm//WebResources/abaxis_popup?Data=recordid%3dElectrolyte%26sometext%3daw_device%26somemoretext%3dpolyclinic";
Replace the HTML chars to the regular text chars.
urlString = urlString.replace(/%26/g, '?');
urlString = urlString.replace(/%3d/g, '=');
Use the function in the duplicate question answer to parse the params and values
Generously contributed by : weltraumpirat
function transformToAssocArray( prmstr ) {
var params = {};
var prmarr = prmstr.split("&");
for ( var i = 0; i < prmarr.length; i++) {
var tmparr = prmarr[i].split("=");
params[tmparr[0]] = tmparr[1];
}
return params;
}
Use it.
var result = transformToAssocArray(urlString);
A working example of the proceedure : JSFiddle