javascript - Message error its not showing using ajax via jQuery -


im trying update data in form via ajax jquery.

im doing update sucess, when have empty fields im not getting error message saying: mymodal('config_datas_errempty','alert','fill al fields please');

and if write wrong format email dont have message too.

do see might error? because me everyting seems fine , review code many times!

my php:

 switch ($action)     { case 'data_update':       $d['adress'] = $_post['adress'];      $d['phone'] = $_post['phone'];      $d['fax'] =      $_post['fax'];      $d['email']=     $_post['email'];      if(in_array('',$d))     {         echo 'errempty';     }     else if(!valmail($d['email']))     {         echo 'erremail';     }       else      {          $updatedata= $pdo->prepare("update config_data set adress=?, phone =?, fax=?, email=? id = ?");          $updatedata->bindvalue(1, $d['adress']);           $updatedata->bindvalue(2, $d['phone']);          $updatedata->bindvalue(3, $d['fax']);          $updatedata->bindvalue(4, $d['email']);          $updatedata->bindvalue(5, '1');          $updatedata->execute();       }     break; default: echo 'error'; } 

my jquery:

 $('form[name="config_data"]').submit(function(){     var forma = $(this);     var data = $(this).serialize() + '&action=data_update';     $.ajax({         url:    url,         data:   data,         type:   'post',         beforesend: function(){             forma.find('.load').fadein("fast");         },         success: function( datas ){             if(datas == 'errempty'){                 mymodal('config_datas_errempty','alert','fill al fields please');             }else if((datas == 'erremail')){                 mymodal('config_datas_accept','accept','sucess update');                 }         },         complete: function(){             forma.find('.load').fadeout("fast");         }                });     return false; });  


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -