<!DOCTYPE html>
<html>
<head>
<!-- configure DOJO framework -->
<script>
var dojoConfig = { parseOnLoad:true };
</script>
<script src="js/dojo/dojo.js"></script>
</head>
<body>
<form action="/resources/spam" method="PUT">
<button type="submit" >
TRY PUT
</button>
</form>
<form action="/resources/spam" method="DELETE">
<button type="submit" >
TRY DELETE
</button>
</form>
<form action="/resources/spam" method="GET">
<button type="submit" >
TRY GET
</button>
</form>
<br>
<br>
<button type="button"
onClick="doPut()" >
TRY XHR PUT
</button>
<br>
<button type="button"
onClick="doDel()" >
TRY XHR DELETE
</button>
<script>
function doPut()
{
dojo.xhrPut({
url: "/resources/spam",
data: "Canned Spam",
handleAs: "text",
load : function(data) { alert( "OK: " + data ); },
error: function(error){ alert ( "An error occurred: " + error ); }
});
}
function doDel()
{
dojo.xhrDelete({
url: "/resources/spam",
handleAs: "text",
load : function(data) { alert( "OK: " + data ); },
error: function(error){ alert ( "An error occurred: " + error ); }
});
}
</script>
</body>
</html>