+3  A: 

Using this code:

$("form")

will find all the <form> elements in your document.

Given that form is a string containing the name of the form, what you want instead is this:

$("form[name='" + form + "']")

Looking at your supplied code, I have this suggestion. Instead of passing the form name to your function, why not just pass the form itself?

<button onclick="xmlhttpPost('blah', this.form)">

You also don't need to put javascript: in the onclick, onfocus, onwhatever properties.

nickf
perfect, that worked like a charm. I removed the `javascript` changed to `this.form` and used `$(form).serialize();`. Thank you for the help!!!!
shaiss
A: 

I would suggest putting an ID attribute on the form and then using that ID as an explicit selector for jQuery:

<div class="outside_job_box">
  <form id="outside_job_form" name="outside_job_form">
      <input type="text" name="clock_code" placeholder="Clock Code" />
      <input type="text" name="message" placeholder="Message (Blank for none)"/>
      <input type="hidden" name="type" value="ouside_job" />
      <input value="Outside Job" type="button" onclick='JavaScript:xmlhttpPost("clockin.php", "outside_job_form")'></p>
  </form>
</div>

Then you would select and serialize it like this;

var f = $("#outside_job_form").serialize();

Not only making your code more effecient but more readable, in my opinion.

CmdrTallen