Jump to content

Save Javascript Variables to PHP/mySQL


dOUbleOfour

Recommended Posts

I have this code in my web

[code]<script type="text/javascript">
   var pageViewerID = 02;
   var pageOwnerID = 01;
   var pageViewerFName = "cat";
   var pageOwnerFName = "dog";
   var pandoraRegFlag = '-1';
  
   refreshCachedPage();
  
  </script><script>
[/code]

This is the piece of my profiles code. Everytime someone visits/open my profile the "var pageViewerID" changes depending of what's the visitors ID and also the "var pageViewerFName".

And i want to know who whowed my profile so that im wondering if is it possible to save those "var pageviewerID" and "var pageViewerFName" to a log like PHP or mySQL?
Link to comment
Share on other sites

The only way this can be done is to use AJAX (asynchonous Javascript) to start a small PHP script in the background on the server. If you are unfamiliar with AJAX, there is a sister forum to this one on [a href=\"http://www.ajaxfreaks.com/\" target=\"_blank\"]ajaxfreaks.com[/a]. You can also take a look at the [a href=\"http://developer.yahoo.com/yui/connection/\" target=\"_blank\"]Connection Manager[/a] in the Yahoo! Developer Network.

Ken
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.