Javascript 如何用url中的替换%23?

Javascript 如何用url中的替换%23?,javascript,php,jquery,html,css,Javascript,Php,Jquery,Html,Css,单击“提交”按钮时,url为: http://localhost/college/index.php?field=1&exam=ATMA&submit3=%23success 我想将此链接替换为: http://localhost/college/index.php?field=1&exam=ATMA&submit3=#success 如何执行此操作?请尝试以下组件: 请尝试以下组件: 您正在寻找的功能包括 PHP: Javascript: decodeURI

单击“提交”按钮时,url为:

http://localhost/college/index.php?field=1&exam=ATMA&submit3=%23success
我想将此链接替换为:

http://localhost/college/index.php?field=1&exam=ATMA&submit3=#success
如何执行此操作?

请尝试以下组件:

请尝试以下组件:


您正在寻找的功能包括

PHP:

Javascript:

decodeURIComponent(string);
encodeURIComponent(string);

您正在寻找的功能包括

PHP:

Javascript:

decodeURIComponent(string);
encodeURIComponent(string);

提交时,您的后端是否希望submit3的值成功?如果是这样,不要更改它,在后端处理它。A有特殊的含义。这就像尝试获取submit3=&success以获得submit3=&success一样-您需要以与此处编码相同的方式对&进行编码。提交时,后端是否希望submit3的值为success?如果是这样,不要更改它,在后端处理它。A有特殊的含义。这就像试图获得submit3=&success以获得submit3=&success—您需要以与此处编码相同的方式对&进行编码。
decodeURIComponent(string);
encodeURIComponent(string);