jquery - Fetching values from url and displaying them -
hi have following url trying extract values.
http://xxxxxx.com/confirm.aspx?vcode=123xyzd33eed&emailaddress=xxx@hotmail.com&
i trying extract values of vcode , emailaddress display in appropriate fields.
<input type="text" id="text1" name="validationcode" value="<? echo htmlspecialchars($_get["validationcode"]); ?>" placeholder="validationcode"/> <input type="text" id="emailaddress" name="emailaddress" value="<? echo htmlspecialchars($_get["emailaddress"]); ?>" placeholder="email address" />
the above code doesnt display values of vcode , emailaddress. ideas how fix it? thanks
function getparameterbyname(uel, name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regex = new regexp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(url); return results == null ? "" : decodeuricomponent(results[1].replace(/\+/g, " ")); } url = "http://xxxxxx.com/confirm.aspx?vcode=123xyzd33eed&emailaddress=xxx@hotmail.com&"; alert(json.stringify(getparameterbyname(url, "vcode"))); alert(json.stringify(getparameterbyname(url, "emailaddress")));
Comments
Post a Comment