I am using CakePHP 1.26.
I was trying to use jQuery Ajax to pass some sample data to a function in a Controller but failed to do it.
This is the jQuery part:
var w="helloworld";
var curl="http://localhost:8080/test/grab/";
$.ajax({
type: "POST",
url: curl,
data: "testing="+w,
success: function(data) {
alert(data);
}
});
And this is the function of the Controller:
function grab() {
$g=$this->data['testing'];
return $g;
}
But the alert msg box did not show me anything but a blank message.
Please help if you could.