Script to check error message from ajax call

Ajax call captures error message/exception that are thrown on its failure. Below is the way to get that error message.

                type: "POST",
                url: "Sample/Method",
                  //process response object
                error:function (xhr, ajaxOptions, thrownError){                                
                alert(xhr.status); //get error status code                  
                alert(thrownError); //get error message

                alert(xhr.responseText); //get error details

Below is the breif description of these error terms:
  • xhr.status -- Use this when you have to deal with the error status code, for example session expiration.
  • thrownError -- Use this when you want to display/use error message as it is.
  • xhr.responseText -- Gives you details of error message like cause of error, source of error, etc. Helpful for coders as they come to know cause of error at early stage.

Links for learning JQuery

Hi...found some good links that will be helpful to learn JQuery and also to improve it. Please have a look at them...


Best practice for using Html Spacing

I was confused with the difference between   and  . Found one good point of UI designing. So sharing with you. Please have a look.

You  might have tried to add spaces between two controllers using either   or  . If you are confused with what to use, here is the difference between two:

  is the character entity reference while   is the numeric entity reference.
They are the same except for the fact that the latter does not need another lookup table to find its actual value.

So, it’s better if you use  . to improve performance!