Ajax Responce
Posted: Thu Nov 24, 2011 12:21 pm
Hi,Im using jquery to call a php file and then display the responce via alert. (in cakephp).
Here's my controller;
And my Jquery Code;
So it should displa 'Hello'in the alert box but is is instead displaying the view for the 'login' action, which is the page we are already on.
Any Ideas?
Many Thanks
Chris
Here's my controller;
Code: Select all
public function login()
{
echo "hello";
}Code: Select all
function sendToPHP()
{
$.ajax({
url:"http://www.testserver.com/accounts/login",
type:"POST",
data:$('#loginForm').serialize(),
success:responseLogin,
context:this
});
}
function responseLogin(response)
{
alert(response);
}Any Ideas?
Many Thanks
Chris