Rookie question: I have the following JavaScript functions. This works correctly but I don't want to hardcode the strings "Names" and "namesDiv". I want to pass them in as parameters to the getItems().How do I do this?
Edit: The function GetMsg() returns a JSON object: result.
HTML:
<input type="button" onclick="getItems(); return false;" value="Go"/>
JS:
function getItems() {
loadingMsg();
GetMsg("Names", null, callback);
}
function callback(result, args){
clearContainer();
//do stuff
document.getElementById("namesDiv").append(foo);
}
function loadingMsg(){
clearContainer();
// do stuff
document.getElementById("namesDiv").append(foo);
}
function clearContainer(){
document.getElementById("namesDiv").innerHTML = "";
}