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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -