In jQuery generally using two methods for data posting. There is a chance of happening errors, for tracking get or post error use a jQuery fail() method. If error occurred will return to jQuery fail() method. $.post(“url”,function(userdata){ alert(userdata) ); }).fail(function(){ // error code here alert(‘page not found’) });