Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Cannot remove backslashes from returned array value, javascript

$
0
0

I am creating a button on the account homepage that will launch a map, the map contains multiple pins for the address of selected accounts.  I have the button working, and I use the Xrm.Utility.openWebResource where I pass over an encoded array.  My issue comes when I decode the parameter, it is coming over with lots of backslashes \ that I cannot clear out.

function initMap()

{ var vals = new Array(); vals = location.search.substr(1).split("&"); for (var i in vals) { vals[i] = vals[i].replace(/\+/g, " ").split("="); } for (var i in vals) { if (vals[i][0].toLowerCase() == "data" )
{
vals = decodeURIComponent(vals[i][1]).split("&");


vals[0] returns the following

"[\"123 fake st, new york, NY, 12345\",\"9700 not real rd, orlando, FL, 98765\",\"again test rd, fakesite, MN, 77777\"]"

I need to turn these addresses into an array with just the address, but I have been having a lot of trouble removing the backslash \.

I have tried the below among other things, without any luck. Does anyone know how to get the backslash out?
.replace("/\\/","")
.replace("/\\/g","")
.replace(/\\/g,"")
.replace(/\\/,"")


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images