smartin1017 Posted January 17, 2009 Share Posted January 17, 2009 Hi guys, I am trying to create a facebook like feed. I want people to be able to enter in comments almost like a chat room but comments can be commented on. I assume this is done with ajax where it is instant and no page loading but i am not sure. I figured I would start here because I have not had a time where I couldnt find the answer here yet. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/141238-instant-feed/ Share on other sites More sharing options...
DeanWhitehouse Posted January 17, 2009 Share Posted January 17, 2009 I assume you have a question? If the question is does facebook use ajax for this then yes they do. Quote Link to comment https://forums.phpfreaks.com/topic/141238-instant-feed/#findComment-739244 Share on other sites More sharing options...
dawsba Posted January 17, 2009 Share Posted January 17, 2009 ummmm, face book dont use true ajax, more or a beaten up version, chopped down crappy similarity FBML:// . you could write in javascript/ajax/php very simple i can send you a basic script that will do that, or you can use the old fashioned way of iframe refresh. let me know Quote Link to comment https://forums.phpfreaks.com/topic/141238-instant-feed/#findComment-739251 Share on other sites More sharing options...
smartin1017 Posted January 17, 2009 Author Share Posted January 17, 2009 I would love it if you would send me the script. The question was how do they do it. I know it goes into a db and comes out but the instant part is what I was trying to figure out. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/141238-instant-feed/#findComment-739274 Share on other sites More sharing options...
DeanWhitehouse Posted January 17, 2009 Share Posted January 17, 2009 The "instant part" is ajax Quote Link to comment https://forums.phpfreaks.com/topic/141238-instant-feed/#findComment-739275 Share on other sites More sharing options...
dawsba Posted January 18, 2009 Share Posted January 18, 2009 sorry to take so long to reply, tis a saturday night afterall lol, asign your div id to somthing like id="thisdiv" or whichever have a script with the output code ready to generate such as ajaxresponse1.php in your running script do a js call either by function call or onclick event assign JS VAR getvars to whatever you need sending to remote script such as display=2&frog=froggy such as onclick="sndReq('thisdiv','ajaxresponse1.php?'+getvars)" now thisdiv should display what ever output ajaxresponse1.php has have fun function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); var returnDiv function sndReq(divRet,file) { var date = new Date(); var timestamp = date.getTime(); returnDiv = divRet; http.open('get', file+'&time='+timestamp); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; document.getElementById(returnDiv).innerHTML = response; } } Quote Link to comment https://forums.phpfreaks.com/topic/141238-instant-feed/#findComment-739407 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.