Created
July 22, 2014 06:28
-
-
Save jimmyhillis/8a41c5795abe1ce2e962 to your computer and use it in GitHub Desktop.
Example JS for Peet
This file contains hidden or 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
<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