I have a piece of coding that I feel it is wrongly codded. It shows everything as "success". function URLSubmit(url,data,str){ $.ajax({ url: url, type: 'POST', data: data, beforeSend:function(){ $("#"+str+"_State").html("Please wait..."); }, complete:function(){ $("#"+str+"_State").html("<img src='/images/right.gif'>"); }, success:function(msg){ if (msg!=""){ $("#"+str+"_State").html("<img src='/images/right.gif'>"); }else{ alert(msg); } } }); } Code (markup): Those of you who are experts in this kind of coding, could you please tell me if I am wrong or not? Thanks.