PHP Classes

File: siteaccess/siteaccess.js

Recommend this page to a friend!
  Classes of MarPlo  >  Web Site Traffic and Pages Access  >  siteaccess/siteaccess.js  >  Download  
File: siteaccess/siteaccess.js
Role: Auxiliary data
Content type: text/plain
Description: Ajax function
Class: Web Site Traffic and Pages Access
Record visits of real users to Web site pages
Author: By
Last change:
Date: 3 years ago
Size: 846 bytes


Class file image Download
var nrsecacc = 5;        // number of secconds till ajax function is called to send data to php
var url = window.location;
var title = document.title;

// AJAX function
function ajaxPgAcc() {
  if(nrsecacc > 0) {
    nrsecacc = -1;
    var mypostrequest = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();    // create the XMLHttpRequest object

    parameters = 'url='+ encodeURIComponent(url.pathname + +'&title='+ encodeURIComponent(title) +'&isajax=1';      // data to send to php
    // Sends data"POST", 'siteaccess.php', true);
    mypostrequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

// calls ajaxPgAcc() after "nrsecacc" secconds
setTimeout(ajaxPgAcc, nrsecacc * 1000);