Skip to content

Instantly share code, notes, and snippets.

@devdays
Created December 20, 2014 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devdays/9583bffcc608a7ceda70 to your computer and use it in GitHub Desktop.
Save devdays/9583bffcc608a7ceda70 to your computer and use it in GitHub Desktop.
Single Page App - Amplify example retrieving data
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Store and Brand</title>
</head>
<body>
<h3>Click for Store and Brand</h3>
<p id="products"></p>
<p>Watch for server hits in the developer panel</p>
<input id="productsClick" type="button" value="Click to get products" />
<script src="Scripts/jquery-1.4.4.js"></script>
<script src="Scripts/amplify.js"></script>
<script>
amplify.request.define("easyData", "ajax", {
url: "Data/easydata.txt",
dataType: "json",
type: "GET"
});
$("#products").hide();
$("#productsClick").click(function (eventData) {
// first call retrieves data from server
amplify.request("easyData", function (data) {
$("#products").text(data.products).show();
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment