Ajax Dynamic content change
Ajax
Download (.zip)
<?php if(isset($_GET['sub'])) { echo "Second Text"; exit(0); } ?> <img src='image.jpg' onClick="javascript: var xmlhttp=false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { try { xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } catch (E) { xmlhttp = false; } } @end @*/ if(!xmlhttp) { xmlhttp=new XMLHttpRequest(); } xmlhttp.open('GET','test.php?sub', true); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState==4) { document.getElementById('output').innerHTML = xmlhttp.responseText; } } xmlhttp.send(null); "> <div id='output'>First Text</div>
|