Hi all,
I am using cakePHP 1.26
I got an Input Text box which contains a URL and I want to submit the URL and stored it in the Database using Jquery AJAX.
Here is the HTML part:
<input type="text" id="testing" value="http://stackoverflow.com/questions/ask">
This is the JQuery part:
var whatContent=$("#testing").val();
var curl="http://localhost:8080/test/grab/"+whatContent;
$.ajax({
type: "POST",
url: curl,
success: function(data) {
alert(data);}
});
This is the code for the Action in the Controller:
function grab($w=null){
if($w!=null){
return $w;
}
}
The code worked and I could see the Alert Message pop up, but it showed:
http://stackoverflow.com/
instead of
http://stackoverflow.com/questions/ask
I have tried using escape(whatContent), and encodeURI(whatContent), but they could not help,
the Alert box still showed me
http://stackoverflow.com/
instead of
http://stackoverflow.com/questions/ask
I am not sure how to do with the URL data that contains some special characters in it.