jquery - javascript windows.location string picking -


i have url:

http://localhost/estamo/asset.php?aname=vklqifbsyxph&di=ng== 

and need using javascript

var locat = window.location.href;      $.get("enviaramigo.php?email="+$("#email").val()+"&url="+locat, function(html) { 

but, when use locat var, incomplete url:

http://localhost/estamo/asset.php?aname=vklqifbsyxph 

how complete url?

thanks

you need encode url using encodeuricomponent

var locat = window.location.href;      $.get("enviaramigo.php?email="+$("#email").val()+"&url="+encodeuricomponent(locat), function(html) { 

or base64

$.get("enviaramigo.php?email="+$("#email").val()+"&url="+btoa(locat), function(html) { 

and need decode on sever.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -