CodeIgniter Forums
$.post() Method fails with decimal value in URL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: $.post() Method fails with decimal value in URL (/showthread.php?tid=74601)



$.post() Method fails with decimal value in URL - DanielAttard - 10-13-2019

This is driving my crazy.  This POST returns a 404 Not Found error when there is a decimal value in the URL:
Code:
http://localhost:8080/myController/myMethod/1/2019/123.45/

But this POST succeeds and returns 200 OK when I remove the decimal value:
Code:
http://localhost:8080/myController/myMethod/1/2019/12345/


I'm not sure if this is relevant, but I recently upgraded from CI 2.2.x to 3.1 and I never used to have this problem before.  I don't think I need to encode the value because decimals are used in URLs all the time.   

I hope someone can help me find the problem.


RE: $.post() Method fails with decimal value in URL - InsiteFX - 10-14-2019

You need to url encode it it thinks the decimal is an http place holder.


RE: $.post() Method fails with decimal value in URL - DanielAttard - 10-14-2019

Thanks for the assist. Is there anything different about CI 3.1 compared to CI 2.2 that would cause the different functionality? Why did this work without the need to encode in CI 2.2?


RE: $.post() Method fails with decimal value in URL - jreklund - 10-14-2019

. (dot) are a acceptable URI character. Please see $config['permitted_uri_chars'] in /application/config/config.php in case it's missing.

I haven't tested (dot) myself.

Default:
PHP Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'