views:

281

answers:

3

I've done my homework and scoured SO to no avail. I've even gone from $.post to $.ajax in an effort to clean out everything. There's no cacheing either.

$('#send').click(function() {
     $.ajax({
     url: "submit.php?ts="+new Date().getMilliseconds(),
     cache: false,
     type: 'POST',
     dataType: 'text',
     data: $("#myform").serialize(), 
     success: function(data){
          $('#myspan').html(data);
     }
     });
   });

The form looks like:

<span name="loading" id="loading"></span>
<div id="myspan"></div>
<form onsubmit="return false;" method="post" action="#" name="myform" id="myform">

etc...

What am I doing wrong? This works marvelously in Firefox but nothing happens in IE. The really weird part is that an alert(data) will show the right content in the alert box in IE. The "myspan" div doesn't have any styling or CSS to it either.

A: 

It seems you are expecting a plain string as response: dataType: 'text'. Are you sure that this is what you are returning and that you also send the appropriate header (content-type: 'text/plain')

kgiannakakis
A: 

I'm assuming you have a submit button #send inside the form?

How about trying

var form=$('form#myform').submit(function(){
  //ajax, update html
  return false;
});
$('#send').click(function(){
  form.submit();
  return false;
});
czarchaic
A: 

The problem was that the

<span name="loading" id="loading"></span>
<div id="myspan"></div>

were placed within a <table> tag.

Stupid IE.

grr.

Rio