I’m trying to learn how this function from the “Six Degrees of Kevin Bacon Calculator” works. specifically, I don’t understand what the “a=”, “&b=”, “&u=1”, “&p=” are being used for. I’m teaching myself javascript while also going through the Google App Script tutorials in the hopes of learning how to develop gadgets and parsing xml data to google spreadsheets. Any suggestions on things to study that would help me understand is also appreciated. Thank You!
function kb(from, to) {
if (!to) {
to = "Kevin Bacon";
}
var parameters = {
method : "post",
payload :
"a=" + encodeURIComponent(from) +
"&b=" + encodeURIComponent(to) +
"&u=1" + // movies only. Use "3" to include TV
"&p=" + encodeURIComponent('google-apps')
};
var text = UrlFetchApp.fetch("http://oracleofbacon.org/cgi-bin/xml",
parameters).getContentText();
return parse(text);
}
These parameters are explained in the tutorial on Parsing an XML Document. They’re parameters for the Oracle of Bacon service, rather than something specific to Apps Script itself.