I'm trying to send from JavaScript, by using jQuery, via AJAX, a string that might contain one or more URL's.
That text will be recieved by a CodeIgniter controller.
I'm having some errors. Sometimes it's a 404 error or other times is a 406 error depending on the way I send the data.
Right now I send it like this:
var dsPost = encodeURIComponent(base64_encode(postContent));
$.ajax({
url: "/posts/createTextPost/" + dsPost,
type: "POST",
data: "userIdWall" + "=" + userIdWall,
success: function(data, textStatus, jqXHR) {
},
error: function (jqXHR, textStatus, errorThrown) {
}
});
The base64_encode fn is the phpjs implementation.
In the CI controller I do this:
public function createTextPost($dsPost) {
$dsPost = base64_decode(urldecode($dsPost));
}
The thing is, the data can be saved to the database but I can't understand why the 404 error.
Any ideas?
Thanks.