Skip to content

Instantly share code, notes, and snippets.

@jimmyhillis
Created July 22, 2014 06:28
Show Gist options
  • Save jimmyhillis/8a41c5795abe1ce2e962 to your computer and use it in GitHub Desktop.
Save jimmyhillis/8a41c5795abe1ce2e962 to your computer and use it in GitHub Desktop.
Example JS for Peet
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var communities_url = "http://www.peet.com.au/ClientAsyncSvc.axd?q=getCommunities&sid=1&rids=0&getAll=true&gbr=1&seed=1405924115719";
var Community = function (data) {
this = $.defaults(this, data);
this._available_lots = null;
};
Community.prototype.availableLots = function () {
if (this._available_lots) {
return this._available_lots;
}
this._available_lots = 0;
this.LandListings.forEach(function (listing) {
if (listing.ListingPriceText !== "SOLD") {
this._available_lots += 1;
}
return listing.ListingPriceText !== "SOLD" && ++this._available_lots;
});
available_lots = 1;
2 * available_lots++;
};
Community.prototype.pricesFrom = function () {
};
$(document).ready(function () {
console.log('load stuff');
$.getJSON(communities_url, function (data) {
console.log(data);
});
});
</script>
</head>
<body>
Stuff.
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment