My code is this in which form submition is working throgh ajax with jquery form validation but response not working..
my ajax code :
$("#save_form4").validate({ rules: { name: { required: true }, min_salary:{ required: true, number: true } }, messages: { name: { required: "Job Title is required." }, min_salary:{ required: "Min Salary is required.", number: "Enter Valid Amount." } }, // the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { if ( element.is(":radio") ) error.insertAfter( element.parent() ); else if ( element.is(":checkbox") ) error.insertAfter( element.next() ); else{ if(element.is("textarea")) error.insertAfter(element.next()); else error.insertAfter( element ); } }, submitHandler: function(form) { var formVars = $(form).serialize(); $(form).ajaxSubmit({ type: 'POST', url: '{/literal}{$site_url}vacancies/vacancy_job/{$id}{literal}', async : false, data: formVars, cache: false, success: function(data) { alert('hjkhjh'); $('#job_panel').css('display','none'); $('#job').html(data); }, error : function(){ alert('error'); } }); return false; } });
here in ajax response any alert is not working but it goes in vacancies controller and save data also....anybody please help me.