Q:

Problems with Javascript. Not able to Update Status

I am using the Javascript to update the user's status when he enters some text in the Text area.
Here's the Javascript for it-
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>

       function updateStatus(){
            var status  =   document.getElementById('status').value;
                FB.api('/me/feed', 'post', { message: status }, function(response) {
                    if (!response || response.error) {
                         alert('Error occured');
                    } else {
                         alert('Status updated Successfully');
                    }
               });

</script>

And here's the Form script I am using
  <form action="" method="" onsubmit="updateStatus(); return false;">
  <label for="status">Update Status</label>
  <input type="text" id="status" name="status" size="60" VALUE="Whats on Your mind"/>
  <div align="right" style="height:30px; padding:10px 10px;">
  <label id="shareButton">
  <input type="submit" value="Share">
 </label>
 </div>
 </div>
 </form>

The problem is when I click on Submit the page just gets refreshed.
Any help would be appreciated.
I have uploaded the Entire code for the App at http://pastebin.com/UqzaBjpb

A:

Put the status update on the form's onsubmit instead of the button's onclick. Like so:
<form action="" method="" onsubmit="updateStatus(); return false;">
  <label for="status">Update Status</label>
  <input type="text" id="status" name="status" size="60" VALUE="Whats on Your mind"/>
  <div align="right" style="height:30px; padding:10px 10px;">
    <label id="shareButton">
      <input type="submit" value="Share">
    </label>
 </div>
</form>

Note: It looked like you had an extra div close tag in there so I removed that too.
It also looks like you have not included the js library that would give you FB. Is that included somewhere?

