Created
December 20, 2014 00:29
-
-
Save devdays/9583bffcc608a7ceda70 to your computer and use it in GitHub Desktop.
Single Page App - Amplify example retrieving data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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