Jump to content

Instant feed


smartin1017

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/141238-instant-feed/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/141238-instant-feed/#findComment-739251
Share on other sites

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; 
  } 
}

Link to comment
https://forums.phpfreaks.com/topic/141238-instant-feed/#findComment-739407
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.