javascript - jquery: spaces is added instead of %20 -


i have url (school.php/region%20division). when click anchor tag, should open page have url school.php/region%20division. of moment, page opens url school.php/region division. contains whitespace instead of %20. should keep %20? in advance.

here code

var url=escape("school.php/"+region+' '+division); //school.php/region%20/division $("a.searchlink").html("<a href="+url+">click here</a>"); 

you can use encodeuri(uri) function in javascript

for eg:

<script>  var uri="school.php/region%20division"; document.write(encodeuri(uri)+ "<br>");  </script> 

answer

school.php/region%2520division 

and use it... have encode %20 in url ll give desired output


Comments

Popular posts from this blog

codeigniter - Fatal error: Call to undefined function lang() in CI Merchant using CardSave -

javascript - CasperJS/PhantomJS failing SSL handshakes on some sites even with --ssl-protocol=any -

python - Received unregistered task using Celery with Django -