jQuery functions not working
<p>I wrote the following JavaScript code for saving a document:</p>

<pre><code>function save()
{
$.prompt('Are you sure you want to save changes to this document?',{
  callback: savechanges,
  buttons: { Yes: 'Yes', No: 'No' }
});
function savechanges(v,m){
 document.write('Date hello: ', page);
  if(v=="Yes")
  {
    var content = $('#content').val();// This line is not running
    var page = trim($('#pageid').val()); // This line is not running
    content = escape(content);
    $.post("../gamescripts/save.php",
    {  page: page, content: content },
    function(data){
    if(trim(data)=="success")
        {
       document.location = page ;                                   
        }
    }); 
  }
}
}
</code></pre>

<p>But the following two jQuery lines are unable to extract the data from content and page id: But, they are not generating any errors</p>

<pre><code>    var content = $('#content').val();
    var page = trim($('#pageid').val());
</code></pre>

<p>This is the <code>php</code> file which calls the JavaScript function. I have included the <code>jquery.js</code> library. Do I need to include any other library?</p>

<pre><code>&lt;script type="text/javascript" src="../gamejavascripts/jquery.js"&gt;&lt;/script&gt;

&lt;form id="form1" name="form1" method="post" action="javascript:save();"&gt;

&lt;input name="pageid"  type="text" id="pageid"  value="&lt;?php echo "$url"?&gt;" READONLY/&gt;
&lt;textarea name="content" id= "content" cols="80" rows="18"&gt;";
&lt;?php
$handle = fopen("$url","r");
 while(!feof($handle))
 { 
 $text = fgets($handle);
echo $text;
}
fclose($handle);
?&gt;
&lt;/textarea&gt;

&lt;input type="submit" value="Save"  /&gt;

&lt;/form&gt;
</code></pre>

<p>This is the save.php file</p>

<pre><code>&lt;?php

$content= $_POST["content"];
$page= trim($_POST["pageid"]);
$text = rawurldecode($content);



$myFile = $page;
$fh = fopen($myFile, 'w') or die("can't open file");

$status= "success";

fwrite($fh, $text);
fclose($fh);

echo $status;



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