Created
January 28, 2012 19:46
-
-
Save travishaynes/1695561 to your computer and use it in GitHub Desktop.
Pull shop's progress
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
var goal = 10000.00, // without a goal it will return the total purchase amount after the school percentage is applied | |
shop_id = 1195332, // this can be found in the top-right corner of the metafields app when logged into a shop | |
server = "http://localhost:3000"; // set this to the location of the metafields app | |
// get the shop's percentage using a JSONP AJAX call | |
// Note: This must use JSONP to avoid raising a cross domain access error | |
$.ajax({ | |
url : server + "/progress/" + shop_id + ".json", | |
type : "get", | |
data : "goal=" + goal, | |
dataType: 'jsonp', | |
error : function(x,s,e){ | |
throw e; | |
}, | |
success : function(progress){ | |
// this is just a sample. put the actual code | |
// to handle updating the progress bar here. | |
$("#progress_bar").css("width", (progress * 100) + "%"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment