Question on posting a variable to a php script using the .ajax method
<p>I need help with posting a value to a php script from a js function called by an onclick event in an HTML page. Any help would be appreciated.</p>

<p>I have a link to the Google hosted jQuery library.</p>

<p>I am rendering a page with php with a submit button whose onclick action is seen below as updateSession() which posts a value to a php script that is supposed to update a MySQL table.</p>

<p>I can step through the script wile executing, using Fire Bug, but once it steps back out of the jQuery library no action or messages that I can see.</p>

<p>---------- script details</p>

<p>Part of the echo statement from the php rendered html page:</p>

<pre><code>&lt;input type=\"submit\" value=\"Submit\" class=\"close\" onClick=\"checkCode()\"/&gt;
</code></pre>

<p>The js function called by the submit action (i commented out my original attempt but left in place for comments):</p>

<pre><code>function updateSession (){
 //$.post( "includes/update.php", { action: "y" });
 jQuery.ajax({
  url: "includes/update.php",
  type: "POST",
  processData: false,
  contentType: "text",
  data: { 'action': 'y'},
  success: function( data ) { // for debugging
   alert( data );
  }
 });
}
</code></pre>

<p>The php script being called with the jQuery .ajax:</p>

<pre><code>&lt;?php
 //session_start();
 require("includes/config.php");
 $db = mysql_connect($dbhost, $dbuser, $dbpassword);
 mysql_select_db($dbdatabase, $db) or die ( "Data Server Error");
 // connect to db
 // get session id from $_POST parm
 // add session id + validation marker to sessiondata table
 $action = mysql_real_escape_string($_POST['action']);
 //$idSession = SESSION_ID();

 $idSession = "sdfwe54645gaerg";
 $setCouponStateSql = "INSERT INTO appdata values ($idSession, $action);";
 $executeUpdate = mysql_query($setCouponState);

?&gt;
</code></pre>
