jQuery: Handling Ajax errors

Handling a non-existent resource error

Got this in response:


The jQuery Code START
    
    <script type="text/javascript" src="./jquery-1.5.1.js"></script>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    
    <script type="text/javascript">
      $(document).ready(function() {
          $.ajax( { type: "GET", url: "getterr.php", data: {data: 1}, success: callback, error: err });
     });
    function callback(data, status) {
        $("div").text(data);
    }
    function err(xhr, reason, ex) {
        $("div").text(reason);
    }
    </script>
    
    <style type="text/CSS">
        <!--
        .code { color: red; }
        .back { background-color: yellow; }
        -->
   </style>
  </head>

  <body>
    <h1>jQuery: Handling Ajax errors</h1>
    Got this in response: <div></div>