I am having difficulty getting this AJAX code to work at all. I have two forms, which both activate the same javascript function. Depending on which form the user submits, it either supplies (via the GET method) an "emailunsubscribe" variable or an "email" variable to an external PHP file (submitEmail.php). The PHP figures out all the rest. The output of the PHP should go into a span tag with the id "emailForm." But, nothing happens upon submitting the form, and I can't figure out why.

<script type="text/javascript">
function submitEmail(action)
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
  if (action="addEmail") {
  if (action="unsubEmail") {
Additional Information

I have two different forms on my page. I would like it to happen is that when the user submits either form, this javscript replaces both forms with the output from my external PHP file. Here is how this is set up:

<span id="emailForm">
<form action="javascript:submitEmail('unsubEmail')">
	<p>To unsubscribe from the email list, enter your email here: 
	<input type="text" name="emailunsubscribe" id="emailunsubscribe"> 
	<input type="submit" value="Unsubscribe"></p>


<form action="javascript:submitEmail('addEmail')">
	<p>Add your email to receive our newsletter: 
	<input type="text" name="email" id="email"> 
	<input type="submit" value="Subscribe!"></p>
Let me know if you need any more information, and thanks so much for all your help. I welcome any assistance.