Javascript how to get URL values for my particular URL -
can me values.
i know there few question asked not frame logic given values.
i have url below
http://crm//webresources/abaxis_popup?data=recordid%3delectrolyte%26sometext%3daw_device%26somemoretext%3dpolyclinic
i have variables , data follows
var addparams =encodeuricomponent( "recordid=" + entitylabel + "&sometext=" + entityname + "&somemoretext=" +entityid); xrm.utility.openwebresource('abaxis_popup',addparams ,280,200);
recordid=electrolyte sometext =aw_device somemoretext=polyclinic
note: let know, you're url formatting incorrect.
your url http://crm//webresources/abaxis_popup?data=recordid%3delectrolyte
which translates http://crm//webresources/abaxis_popup?data=recordid=electrolyte
the double =
's after recordid breaking parameters.
so data
param being set recordid
before else happens. not sure want here.
in order remove url string use following :
urlstring = urlstring.replace(/data=/g, '');
as suggested posting duplicate question 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 html chars regular text chars.
urlstring = urlstring.replace(/%26/g, '?'); urlstring = urlstring.replace(/%3d/g, '=');
use function in duplicate question answer parse params , values generously contributed : weltraumpirat
function transformtoassocarray( prmstr ) { var params = {}; var prmarr = prmstr.split("&"); ( var = 0; < 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 proceedure : jsfiddle
Comments
Post a Comment