jquery ajax sucess - possible to return JSON instead of string?
        Posted  
        
            by Haroldo
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Haroldo
        
        
        
        Published on 2010-05-17T16:33:24Z
        Indexed on 
            2010/05/17
            16:40 UTC
        
        
        Read the original article
        Hit count: 177
        
To return an error from a $.ajax call, there's gotta be a better way than echoing an error in the ajax.php file and then trimming it!
this seems very clumsy and in-robust:
success: function(e){ 
    var e = trim(e);
    if(e == 'SUCCESS')
        {alert('your password has been changed!');}   
    if(e == 'ERROR1')
        {alert('please fill in all inputs!');}
    if(e == 'ERROR2')
        {alert('password incorrect!');}
    if(e == 'ERROR3')
        {alert('change failed!');} 
} 
what should i be doing instead?!
© Stack Overflow or respective owner