<script type="text/javascript" src="/scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="/scripts/jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#SendReply").click(function(){
$(".error").hide();
var hasError = false;
var pathname = window.location.pathname;
var random = Math.random();
var messageVal = $("#InquiryResponse").val();
if(messageVal == 'Type your response in this space ...') {
$("#InquiryResponse").after('<span class="error"><br><br><font color="red">You forgot to type your response to the inquiry. Please type it in the above space and submit again.</font><br></span>');
hasError = true;
}
if(hasError == false) {
$(this).hide();
if (jQuery.browser.msie != true) {
$.post("",
{ Detail: messageVal},
function(data) {
//alert("For non IE");
$("#InqRespForm").slideUp("slow", function() {
$("#InqRespForm").before('<h1>Success</h1><p><font color="green">Your message has been sent.</font></p>');
});
});
}
if (jQuery.browser.msie == true) {
jQuery.ajaxSetup({async:false});
$.post(pathname , { Detail: messageVal},function(data)
{
$("#InqRespForm").width($("#InqRespForm").parent().width()).slideUp("slow");
$("#InqRespForm").before('<h1>Success</h1><p><font color="green">Your message has been sent.</font></p>');
});
jQuery.ajaxSetup({async:true});
}
}
return false;
});
});
</script>
<form action="" method="post" id="InqRespForm" name=InqRespForm>
Reply to the above Inquiry : <br/>
<textarea rows="7" name="Detail" id="InquiryResponse" cols="60" colspan=2>Type your response in this space ...</textarea>
<br/>
<input id="SendReply" name="Send" type="submit" value="Send Response" alt="Reply to Inquiry" />
</form>
フォーム送信時にメールを送信します。 FF、Chromeなどで動作しますが、私はIE8でこの作業をしようとしています。あなたが私に解決策を教えることができるなら、私はあなたにビールを買うでしょう。
は、なぜあなたは同期ポストをやってIEを持っているために働くだろうと他のブラウザではありませんか? – Manfre
理由はありません - 投稿した内容は2日間にわたって進化しました。何もそれを動作させることはありません。心配してください - フロントエンドの動作に間違いはありません。フォームは上にスライドし、メッセージが送信されたことを示します。IE8ではメッセージが送信されません。私は問題がIEの$ .postであると思う。私は間違っている可能性がある。私はjQueryを使って数日前から使い始めました。 – Frustrated
[Jquery postはIE 8以前で動作していません](http://stackoverflow.com/q/13997857/1699210) – bummi