What would be the jQuery-based way of refreshing random content that is currently managed by PHP?
$num = Rand (1,5);
switch ($num) {
case 1:
echo '<div>Random content</div>';
break;
// and so on...
}
I’d like to add the option to refresh this content with jQuery. I’m not sure how this might work (I’m only an amateur coder and not familiar with JS beyond using plugins). Would it be as simple as adding an ID to each div and then somehow displaying a new div at each click of an anchor? It doesn’t really need to be random: in number order would be fine. I want to keep the underlying PHP method, or a near equivalent, so that it degrades nicely.