Looking through the live results interface for WSOC, I find these wonderful lines of code:
function setWhere(where) {
if (where == "maal") {
if (klasseConst == "alle") {
sortColumn = "innkomsttid DESC, etternavn";
sortDirection = "ASC";
} else {
sortColumn = "statusmelding DESC, tider.plass ASC, Etternavn";
sortDirection = "ASC";
}
} else if (where == "start") {
sortColumn = "startnummer";
sortDirection = "ASC";
} else {
if (klasseConst == "alle") {
sortColumn = "radiopost.tid";
sortDirection = "DESC";
} else {
sortColumn = "radiopost.plassering ASC, Etternavn";
sortDirection = "ASC";
}
}
whereConst = where;
hentListe();
hentRadioposter();
}
function setKlasse(klasse) {
if (clicked != "false") {
document.getElementById("x"+prevClass).setAttribute("class", "nonclicked");
}
var tmp = klasse.replace(",", "");
document.getElementById(tmp.split(' ').join('')).setAttribute("class", "clicked");
tmp = tmp.substr(1);
prevClass = tmp.split(' ').join('');
clicked = "true";
klasseConst = klasse.substr(1);
if (whereConst == "maal") {
if (klasse == "xalle") {
sortColumn = "innkomsttid DESC, etternavn";
sortDirection = "ASC";
} else {
sortColumn = "statusmelding DESC, tider.plass ASC, Etternavn";
sortDirection = "ASC";
}
} else if (whereConst == "start") {
sortColumn = "startnummer";
sortDirection = "ASC";
} else {
if (klasse == "xalle") {
sortColumn = "radiopost.tid";
sortDirection = "DESC";
} else {
sortColumn = "radiopost.plassering ASC, Etternavn";
sortDirection = "ASC";
}
}
hentListe();
hentRadioposter();
window.scrollTo(0,0);
}
and finally they build a URL and just send that over to the server!
url=url+"?q="+encodeURIComponent(klasseConst)+"&w="+whereConst+"&s="+sortDirection+"&c="+sortColumn+"&a="+arr+"&acc="+acc+"&lang="+lang;
Little Bobby Tables needs to be entered into one of their events.