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
https://forums.phpfreaks.com/topic/9703-save-javascript-variables-to-phpmysql/
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

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.