javascript - jquery ajax action when there is no error -


i not understand off logic. have typical form use ajax submit data.

$('#contactform').on('submit',function(e){     var formmsg = $('#contactformreturnmsg');     formmsg.empty();     e.preventdefault();     $.post('contact.php', $('#contactform').serialize(),function(data){         if(data.error){             formmsg.append(data.error);         }else{             formmsg.append("email received!");           }     },"json"); }); 

when have error, error msgs appended correctly. if don't have error, not see else statement run through. why this?


Comments

Popular posts from this blog

Linux vanilla kernel on QEMU and networking with eth0 -

rdbms - what exactly the undo information lives in oracle? -

clojure - 'get' replacement that throws exception on not found? -