pengu Posted June 23, 2010 Share Posted June 23, 2010 Don't actually know if this is possible. Going to post snippets, tell me if more code is required. I have a page called profile.php It shows your profile, I have a link called edit. Upon clicking it, I want aJAX to refresh the DIV with some information obtained from 'functions.php'. Snippet of profile.php <div class=\"pLine\"> <b>Profile Options</b> <a href=\"javascript:editProfile(test)\">[+] Edit</a><br /> </div> <div id=\"myProfile\"> <br /> <b>Email:</b> " .$row['email']. "<br /> <b>Date Joined:</b> <i>" .$row['date_joined']. "</i><br /> <b>Clan:</b> z<br /><br /><br /> </div> functions.js function editProfile(str) { if (str=="") { document.getElementById("myProfile").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myProfile").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","functions.php?q="+str,true); xmlhttp.send(); } functions.php <?php $q = $_GET['q']; switch ($q) { case 'test': echo "<div class=\"important\">This worked!</div>"; break; } ?> Link to comment https://forums.phpfreaks.com/topic/205615-phpajax-get/ Share on other sites More sharing options...
pengu Posted June 24, 2010 Author Share Posted June 24, 2010 I realised how poorly this question was posed. I do not have as strong a grasp on AJAX as I thought. Nevermind. I'll do it another way. Link to comment https://forums.phpfreaks.com/topic/205615-phpajax-get/#findComment-1076439 Share on other sites More sharing options...
pehden Posted June 27, 2010 Share Posted June 27, 2010 I realised how poorly this question was posed. I do not have as strong a grasp on AJAX as I thought. Nevermind. I'll do it another way. its not that bad, im going to test it out on my server see what it does. Link to comment https://forums.phpfreaks.com/topic/205615-phpajax-get/#findComment-1077811 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.