Jquery <span> tag problem in mozilla 3.6.1
I'm using jQuery.post
to print some data I get from a servlet.
<div class="Label">
<span id="result" >Click on Check.</span>
</div>
<script>
$(document).开发者_StackOverflow中文版ready(function() {
$("a").click(function() {
var id = $("#orderId").val();
$.post("paidByDiners", { orderId : id},
function(data) {
$("#result").html(data);
});
});
});
</script>
On Chrome and IE it works fine. However, in Mozilla the response is [object XMLDocument]
.
When I'm using Fiddler2 I see the following response:
HTTP/1.1 200 OK Date: Sun, 27 Mar 2011 10:14:11 GMT Content-Length: 38 This is my response.
How can I solve my problem?
Try adding a dataType
of 'text'
to your $.post
call.
$(document).ready(function() {
$("a").click(function() {
var id = $("#orderId").val();
$.post("paidByDiners", { orderId : id},
function(data) {
$("#result").html(data);
}, 'text');
});
});
精彩评论