Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Ajax Responce

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #35314
    ChrisBull
    Member

    Hi,Im using jquery to call a php file and then display the responce via alert. (in cakephp).
    Here’s my controller;

    public function login()
    {
    echo "hello";
    }

    And my Jquery Code;

    function sendToPHP()
    {
    $.ajax({
    url:"http://www.testserver.com/accounts/login",
    type:"POST",
    data:$('#loginForm').serialize(),
    success:responseLogin,
    context:this
    });
    }
    function responseLogin(response)
    {
    alert(response);
    }

    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

    #91231
    SgtLegend
    Member

    Is there a working demo of this?

    #91241
    ChrisBull
    Member

    No sorry its on my wamp server.

    #91242
    ChrisBull
    Member

    Just needed an exit; :)

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.