spa-1
by rajeshpillai
HTML
<body>
<script type="text/javascript">
var state = 0
$(document).ready(function () {
var hello = "<div>Hello World!</div>"
var goodbye = "<div>Goodbye Cruel World</div>"
$("#region1").html(hello)
$("#switcher").click(function () {
if (state == 0) {
$("#region1").html(goodbye)
state = 1
} else {
$("#region1").html(hello)
state = 0
}
})
})
</script>
<div id="region1"></div>
<div id="region2">
<button id="switcher">Switch HTML</button>
</div>
</body>