ajax error callback is called before firing the action in Symfony 2

Posted by Beginner on Stack Overflow See other posts from Stack Overflow or by Beginner
Published on 2013-11-05T09:46:46Z Indexed on 2013/11/05 9:53 UTC
Read the original article Hit count: 358

Filed under:
|

I'm trying to write an application with Symfony and I'm new to it. I have an ajax call in this application. The problem is that it always fires error call back . I put breakpoint in netbeans IDE and can see that error callback is fired before firing the specified action in the url property of ajax.

action code:

public function userNameExistsAction()
{
    return 'success';
}

javascript:

$('#register_submit').click(function(){
    var path = '/symfony/web/app_dev.php/account/userNameExists';
    //var userName = $('#register_userName').val();        
    $.ajax({
        url: path,
        type: 'GET',                        
        success: function(){ alert('success');},
        error: function() {              
          console.log('error');
        }
    });        
}); 

Any help is appreciated in advance.

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about symfony2