neoaddict Posted April 25, 2006 Share Posted April 25, 2006 [code]<script type="text/javascript"> function makeRequest(url) { var http_request = false; if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); } else if (window.ActiveXObject) { try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Your browser does not support AJAX or XMLHttpRequest!'); return false; } http_request.open('GET', url, true); if (url == "checkcookie.php") { http_request.onreadystatechange = parse; } http_request.send(null); } function parse() { if (http_request.readyState == 4) { if (http_request.status == 200) { var css = http_request.responseText; document.getElementById("topsites").style.display = css; } else{ alert('There was a problem with the request.'); } } } open('checkcookie.php'); function omgmagic() { if(document.getElementById("topsites").style.display == 'none'){ makeRequest('show.php'); document.getElementById("topsites").style.display = ''; } else{ makeRequest('hide.php'); document.getElementById("topsites").style.display = 'none'; } }</script><div style="cursor: pointer;" onclick="omgmagic()">Expand/Collapse Topsites Images[/code]That's my current code so far - I think I've got all the AJAX right, but I don't know what to put in the PHP files except setcookie, perhaps?Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/8369-phpp-cookie-help/ Share on other sites More sharing options...
wildteen88 Posted April 25, 2006 Share Posted April 25, 2006 What! Whats your question? Not a lot of info is comming from what you have said so fair![!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]That's my current code so far - I think I've got all the AJAX right, but I don't know what to put in the PHP files except setcookie, perhaps?Thanks.[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/8369-phpp-cookie-help/#findComment-30638 Share on other sites More sharing options...
neoaddict Posted April 25, 2006 Author Share Posted April 25, 2006 Well, I'm trying to make this AJAX script keep persistence for a collapse div script, I think I've got the AJAX all done, but I can't seem to figure out what to put in the PHP files.checkcookie.php should check if cookies exists, and if so, outputs the value of the cookie to the AJAX script.hide.php is for the hide cookieshow.php is for the show cookie Quote Link to comment https://forums.phpfreaks.com/topic/8369-phpp-cookie-help/#findComment-30755 Share on other sites More sharing options...
neoaddict Posted April 27, 2006 Author Share Posted April 27, 2006 Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/8369-phpp-cookie-help/#findComment-31211 Share on other sites More sharing options...
neoaddict Posted April 28, 2006 Author Share Posted April 28, 2006 Bump. Quote Link to comment https://forums.phpfreaks.com/topic/8369-phpp-cookie-help/#findComment-31688 Share on other sites More sharing options...
neoaddict Posted April 29, 2006 Author Share Posted April 29, 2006 Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/8369-phpp-cookie-help/#findComment-31976 Share on other sites More sharing options...
neoaddict Posted May 1, 2006 Author Share Posted May 1, 2006 Anyone got any ideas on what to put in the PHP files? Quote Link to comment https://forums.phpfreaks.com/topic/8369-phpp-cookie-help/#findComment-32295 Share on other sites More sharing options...
neoaddict Posted May 2, 2006 Author Share Posted May 2, 2006 Sorry for the bumps. :( Quote Link to comment https://forums.phpfreaks.com/topic/8369-phpp-cookie-help/#findComment-32813 Share on other sites More sharing options...
neoaddict Posted May 5, 2006 Author Share Posted May 5, 2006 Does anyone know what I can put in the PHP files?I'm having problems figuring out what to put in them.checkcookie.php should check for the cookie, if exists, display div accordingly and set output to script, if not, send do nothing output to script.Don't know how to send output from a PHP file to an AJAX script. Quote Link to comment https://forums.phpfreaks.com/topic/8369-phpp-cookie-help/#findComment-33479 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.