I have a simple form:
<form class="dataform" method="post" id="settings" action="/">
<input type="radio" name="shareSetting" value="n"/>
<input type="radio" name="shareSetting" value="y"/>
<input type="button" name="sendSettings" value="Store"
class="btn" onClick="javascript:sendSettings();" />
</form>
And the following JavaScript code:
function sendSettings() {
$.ajax({
data: $("form#settings").serialize(),
type: 'post',
url: '?settings=store',
success: function(response) {
$('#divSettings').html(response);
}
});
}
This works perfectly fine in Firefox (3.6 and 4B), Chrome 10, Opera 11, Safari 5 but - you guessed it - not in IE 8.
IE doesn't send the conten开发者_如何学编程t of the radio button, although a value is selected in the browser. It seems that the $("form#settings")
lookup fails in IE for unknown reasons.
Please let me know if any of you ran into the same issue and how you fixed it.
Many thanks!
The error was caused by the structure (seems like a bug in IE to me). Initially I had:
<p> / <form> / <dl> / as listed in the question
The issue was gone as soon as I changed the HTML to:
<form> / <p> / <dl> / as listed in the question
http://jsfiddle.net/ybFRu/1/
check this this works fine in ie,7, ie8
精彩评论