Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //version sin Jquery
- function startChat( idToChat, nameToChat ) {
- document.getElementById('postingChat').innerHTML = "";
- lastDateChat = -1;
- var xmlhttp;
- 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)
- {
- chatTableName = getNumber(xmlhttp.responseText);
- loadPreviousChat(); // White if there wasnt any chat before
- }
- }
- xmlhttp.open("GET","chatQuery.php?to_id="+idToChat+"&user_id=<? echo $data['user_id']; ?>", true);
- xmlhttp.send();
- document.getElementById("person1Img").src = "https://graph.facebook.com/"+idToChat+"/picture";
- document.getElementById("person1Name").innerHTML = nameToChat;
- document.getElementById("person1").style.visibility = "visible";
- }
- */
- ***************************************************************************************************
- */
- //Lo mismo con JQuery
- function startChat( idToChat, nameToChat ) {
- document.getElementById('postingChat').innerHTML = "";
- lastDateChat = -1;
- $.ajax({
- type: "GET",
- url: "chatQuery.php?to_id="+idToChat+"&user_id=<? echo $data['user_id']; ?>",
- dataType: "jsonp",
- success: function (data,status,xmlhttp) {
- chatTableName = getNumber(xmlhttp.responseText);
- loadPreviousChat(); // White if there wasnt any
- },
- });;
- document.getElementById("person1Img").src = "https://graph.facebook.com/" +idToChat+"/picture";
- document.getElementById("person1Name").innerHTML = nameToChat;
- document.getElementById("person1").style.visibility = "visible";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement