Jump to content


Photo

Save Javascript Variables to PHP/mySQL


  • Please log in to reply
2 replies to this topic

#1 dOUbleOfour

dOUbleOfour
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 15 May 2006 - 11:59 AM

I have this code in my web

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


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?

#2 dOUbleOfour

dOUbleOfour
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 15 May 2006 - 03:39 PM

anyone please... [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

#3 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 15 May 2006 - 04:18 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users