GIF89a php
Current File : /home/hencockfreshchic/public_html/app_old/js/sendToChat.js
function sendToChat(frnd_id,my_id)
{
	if(my_id=="")
	{
		window.location.href = ("logout.php");
	}
	else
	{
			if (window.XMLHttpRequest) {
	            xmlhttp = new XMLHttpRequest();
	        } else {          
	            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	        } 
	  xmlhttp.onreadystatechange=function() 
	   {
	    if (this.readyState==4 && this.status==200) 
		{
	      if(this.responseText==1)
	      {
	      	window.location.href = ("https://careisk.in/chat2.php?my_id="+my_id+"&frnd_id="+frnd_id);
	      	//console.log("chat2,"+"https://careisk.in/chat2.php?my_id="+my_id+"&frnd_id="+frnd_id);
	      }
	      else if(this.responseText==3)
	      {
	      	var x = document.getElementById("snackbar");
	      	$("#snack_msgg").html("Plan expired, Please recharge");
 			 x.className = "show";
  			setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000);
	      }
	       else if(this.responseText==4)
	      {
	      	var x = document.getElementById("snackbar");
	      	$("#snack_msgg").html("Low balance, Please recharge");
 			 x.className = "show";
  			setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000);
	      }
	      else
	      {
	      	var x = document.getElementById("snackbar");
	      	$("#snack_msgg").html("Failed to connect");
 			 x.className = "show";
  			setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000);
	      }		
		}
	  };
	  xmlhttp.open("GET","sendToChat.php?frnd_id="+frnd_id+"&my_id="+my_id,true);
	  xmlhttp.send();
	}
}