title: use ajax to call php to write timestamp to file
body: <p>I'm trying to call a function in javascript to write to a text file.  This function uses ajax to to run some code in a php file.  All my code seems to be working fine, but I havent gotten any output (If the file doesn't exist, I want it to be created when the php code runs).  Everything is being run locally and must be run in chrome.  I've found some other people with similar questions, but I wasn't able to apply those solutions.  I am very new so please be explicit.  Also, if there is a better way to do this (get the system timestamp and write/append to a text file) I am more than open.  I just need to record the timestamp whenever a particular javascript function is called.  In addition, I would like to eventually pass a string from my running javascript to be saved with each timestamp (the string is determined by the running javascript).  Note that running in "Data: running" is a dummy variable.  Eventually this will be used to pass a string.</p>
  
  <p>im using this script to use ajax (in html script)</p>
  
  <pre><code>script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"
  
  javascript code..... call recordTone().... javascript code
  
  
  function recordTone() {
      $.ajax({
          url: "file:///C:/Users/ryan/Desktop/New%20folder/saveTimeStamp.php",
          type: "POST",
          data: running,
          success: function (msg) {
              alert(msg);
          }
      });
  }
  </code></pre>
  
  <p><code>saveTImeStamp1.php</code> in entirety</p>
  
  <pre><code>&lt;?php
      $my_file = 'session1.txt';
      $handle = fopen($my_file, 'w') or die('Cannot open file:  '$my_file);
      $data = microtime();
      fwrite($handle, $data);
      fclose($handle);
      echo "YES";  
  ?&gt;
  </code></pre>