changed so that jquery-ajax would work with a switch statement