Everything is going well with my ajax code when passing variables, lets say "hello world" but when passing a variable containing such as "hello world http//www.facebook.com" leads to many problems actually.
Actually its the variable "new_textarea" that I am having problem with. To clarify things out say,
var new_textarea = "hello world"; //successfully saves it to database
but when
var new_textarea = "http://www.facebook.com" // will lead to problems
This is my ajax code:
$.ajax({
url: '/learns/quickpostcomment/'+user_discussion_id+'/'+user_id+'/'+new_textarea+'/'+parent_id,
success: function(data){
}});
And this is my cakephp:
public function quickpostcomment()
{
$post = $this->params['pass'];
$this->ClassroomComment->create();
$this->ClassroomComment->set('classroom_id', $post[0]);
$this->ClassroomComment->set('user_id', $post[1]);
$this->ClassroomComment->set('comment', $post[2]);
$this->ClassroomComment->set('parent_id', $post[3]);
$this->ClassroomComment->save();
die;
}
So far all that I inspected is that whats triggering the problem is the "/" or slashes on the variables when variables contain a url.
Is there any way I can pass a variable to my ajax containing slashes or url? I need help badly :(