JQuery .submit function will not submit form in IE

Posted by Sean on Stack Overflow See other posts from Stack Overflow or by Sean
Published on 2010-04-14T16:32:29Z Indexed on 2010/04/14 16:53 UTC
Read the original article Hit count: 547

Filed under:
|

I have a form that submits some values to JQuery code,which then which sends off an email with the values from the form.It works perfectly in Firefox, but does not work in IE6(surprise!) or IE7. Has anyone any suggestions why? greatly appreciated?I saw on some blogs that it may have something to do with the submit button in my form but nothing Ive tried seems to work.

Here is the form html:

<form id="myform1">

<input type="hidden" name="itempoints" id="itempoints" value="200"> </input>

<input type="hidden" name="itemname" id="itemname" value="testaccount"> </input>

<div class="username">
    Nickname:

    <input name="nickname" type="text" id="nickname" />
</div>
<div class="email">
    Email:
    <input name="email" type="text" id="email" />
</div>
<div class="submitit">
    <input type="submit" value="Submit" class="submit" id="submit" />
</div>

</form>

and here is my JQuery:

var $j = jQuery;

$j("form[id^='myForm']").submit(function(event) {

 var nickname = this.nickname.value;
 var itempoints = this.itempoints.value;
 var itemname = this.itemname.value;
 event.preventDefault();  
 var email = this.email.value;
 var resp = $j.ajax({
  type:'post',
  url:'/common/mail/application.aspx',
  async: true,
  data: 'email=' +email 
   + '&nickname=' + nickname 
   + '&itempoints=' + itempoints 
   + '&itemname=' + itemname,
  success: function(data, textStatus, XMLHttpRequest) {
   alert("Your mail has been sent!");
   window.closepopup();

  }
 }).responseText;
 return false;
});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about form-submit