I am trying to create a function that upon each call it chooses the next variable in an array.
var nexttest=['abc','def','ghi'];
function nexttest() {
if (nexttest = 'abc') {
$('#result').load('url1.html');
}
else if (nexttest = 'def') {
$('#result').load('url2.html');
}
else {
$('#result').load('url3.html');
}
}
Is there a way to make nexttest() use abc the first time, def the second time, and ghi the third time.