I'm trying to call a controller function using the .load() function but I'm getting an error probably because of the '.' encoding. I'm doing the call like this:
$("#main-content").load(
url + "/" + encodeURIComponent(text1) + "/" + encodeURIComponent(text2)
);
Everything goes fine except when text1 ends with a period:
var text1 = 'This causes error.';
The url is encoded like:
http://localhost/index.php/controller/function/This%20causes%20error./Text2
And I'm getting a 404 error in the Chrome console, so I suspect that the '.' is breaking the URL.
I've been looking a lot of posts like this or this, but those solutions doesn't work for me. I'm thinking into create a function that converts the '.' into any other character and then do the opposite in the server, but I prefer to look for something more "elegant" first.
Any ideas? Thanks