ajax
Couple of things to consider:
1) I agree, don't refresh the page every time. All you want is to append to the DOM tree the next question, for example you can easily do this with jqeury and ajax;
2) Instead of keeping the logic in code, keep it in data. This way you can avoid nested if-else. Depend on the flow of questions, if it is tree like, keep it in XML, any data structure that reprents tree, JSON etc;
3) Whether to send the entire "tree" over in one shot or question by question (chunk by chunk). Chunk by chunk is in general better, and there might even be security reasons that you should not send the whole thing over in one shot...
|