javascript - escape single quote in JKL.Parsexml -


i'm facing strange problem escaping single quote through xml parser:

var strcallurl = contextpath + "controller?formfilter=registration&selectedusertype="+usertype+"&emailid="+advisoremail;
strcallurl = strcallurl.replace(/'/g, "\'");
alert(strcallurl);
var objseamlessregload = new jkl.parsexml.text(strcallurl,'','post');

when hit last line, doesn't go forward because of singlequote inserted in email address(var advisoremail), without single quote in variable, works absolutely fine. possible escape single quote through jkl.parsexml.text()?

i have tried "\'" , tried escape(strcallurl), none of these seem work.

using escape work, applying entire url, encode in url shouldn't encoded.

use on value only, , use encodeuricomponent method instead (best practice: escape, or encodeuri / encodeuricomponent):

var strcallurl = contextpath + "controller?formfilter=registration&selectedusertype="+usertype+"&emailid="+encodeuricomponent(advisoremail); alert(strcallurl); var objseamlessregload = new jkl.parsexml.text(strcallurl,'','post'); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -