admin管理员组

文章数量:1406140

when I click on submit button url is:

http://localhost/college/index.php?field=1&exam=ATMA&submit3=%23success

I want to replace this link with:

http://localhost/college/index.php?field=1&exam=ATMA&submit3=#success

How can I do this ?

when I click on submit button url is:

http://localhost/college/index.php?field=1&exam=ATMA&submit3=%23success

I want to replace this link with:

http://localhost/college/index.php?field=1&exam=ATMA&submit3=#success

How can I do this ?

Share Improve this question asked Jan 17, 2017 at 10:06 sam ortensam orten 2064 silver badges18 bronze badges 1
  • 2 When you submit, is your backend expecting the value for submit3 to be #success? If so, don't change it, handle it in the backend. A # has special meaning. it would be like trying to get submit3=&success to have submit3 = &success - you'd need to encode the & in the same way that # is encoded here. – fdomn-m Commented Jan 17, 2017 at 10:10
Add a ment  | 

2 Answers 2

Reset to default 3

The functions you are looking for are

PHP:

urlencode($string);
urldecode($string);

Javascript:

decodeURIComponent(string);
encodeURIComponent(string);

Try the following decodeURIComponent:

decodeURIComponent('http://localhost/college/index.php?field=1&exam=ATMA&submit3=%23success')

本文标签: javascripthow can I replace 23 within urlStack Overflow