1

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 ?

sam orten
  • 206
  • 3
  • 16
  • 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. – freedomn-m Jan 17 '17 at 10:10

2 Answers2

3

The functions you are looking for are

PHP:

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

Javascript:

decodeURIComponent(string);
encodeURIComponent(string);
kscherrer
  • 5,486
  • 2
  • 19
  • 59
2

Try the following decodeURIComponent:

decodeURIComponent('http://localhost/college/index.php?field=1&exam=ATMA&submit3=%23success')
Syden
  • 8,425
  • 5
  • 26
  • 45