jquery ajax codeigniter

jquery ajax codeigniter

Hi y'all,

I am new here so please go easy on me! I am using jquery with Codeigniter and I wanted to echo out errors from failed validation or success messages from any successful interaction with my form and it doesn't work. without using ajax in jquery it's fine, takes me to a blank page with errors only but with ajax it doesn't come. Upon looking closely with firebug, I looked at the request made (I am using $.ajax), the response carries the entire webpage of either the page where the form is on or another page. Below is a snippet of the javascript I wrote:

  1. $('#suppform').submit(function(eve){
                eve
    .preventDefault();
            $.
    ajax({
            type
    'POST',
                    
    cachefalse,
            
    url'homepage/showsupport',
            
    data: $('#suppform').serialize(),
            
    beforeSend: function(){
                        
    $('#supportform').block({message:'<h4> Processing...</h4>'})
            
    },
            
    complete: function(){
                
            }

    ,
            
    success: function(html){
                        
    $('#errorsechoed').text(html);
            
    }

                    }

    );
        
    });