Pages

Tuesday, March 13, 2012

Ajax jQuery style


I am trying out the comma-first style for my objects. I got errors many times when I added a new pair to an object list because I didn't add a comma to the last pair.


Although curl gives a more informative message, I cannot get the same information out of statusCode 412.


<html>
<head>
<script type="text/javascript" src="jquerymin.js"></script>
<script type="text/javascript">
  function initialize() {
    $.ajax({
      type: "PUT"
    , url: "http://127.0.0.1/couchdb/albums"
    , success: function(data) {
        alert(data);
      }
    
    , statusCode: {
        412: function(jqXHR, textStatus, errorThrown) {
          alert(textStatus);
        }
      }
    });
  }
</script>
</head>
<body onload="initialize()">


</body>
</html>

No comments:

Post a Comment