我有以下表單在Chrome中工作得很好,但在Firefox中似乎不起作用。一些谷歌搜索已經告訴我,它的跨域問題。我無法弄清楚如何修復它?Jquery Ajax表單,跨域火狐問題
此外,我確實嘗試將它發送到本地php文件,該文件將重定向到具有變量的跨域URL,但這似乎也沒有辦法。任何幫助將非常感激!
<script type="text/javascript">
$(function() {
$("#requestaction").click(function() {
$("#thecallform").fadeOut(1000, function(){
$("#crcontent-thanks").fadeIn(500);
});
// validate and process form here
var fname = $("input#first_name").val();
var lname = $("input#last_name").val();
var email = $("input#email").val();
var phone = $("input#phone").val();
var retURL = $("input#retURL").val();
var dataString = 'first_name='+ fname + '&email=' + email + '&phone=' + phone + '&last_name=' + lname + '&retURL=' + retURL;
//alert (dataString);return false;
$.ajax({
type: "POST",
url: "http://www.blah.com?",
data: dataString
});
return false;
});
});
</script>
<form name="reqform" id="reqform" action="">
<input id="retURL" name="retURL" type="hidden" value="http://www.google.com" />
<div style="float:right;font-weight:bold;line-height:50px;padding-right:20px;padding-top:11px;margin-right:-3px;">
<div id="affiliates">
<a href="/invest" style="color: rgb(0, 0, 0); text-decoration: none;"> </a>
<div style="margin: 4px auto; width: 112px;">
<div class="button-left">
</div>
<div class="button-middle">
<div class="submit-button" id="requestaction" style="line-height: 36px; width: 100px; text-align: center;cursor:pointer;">
Request a Call</div>
</div>
<div class="button-right">
</div>
</div>
</div>
</div>
<div><input id="first_name" name="first_name" type="text" value="First Name" class="callforminput" style="margin:6px 10px 0px 10px" onfocus="if(this.value=='First Name'){this.value=''};" onblur="if(this.value==''){this.value='First Name'};"></div>
<div><input id="last_name" name="last_name"type="text" value="Last Name" class="callforminput" style="margin:6px 10px 0px 0px" onfocus="if(this.value=='Last Name'){this.value=''};" onblur="if(this.value==''){this.value='Last Name'};"></div>
<div style="clear:left;"><input id="email" name="email" type="text" value="E-mail" class="callforminput" style="margin:6px 10px 0px 10px" onfocus="if(this.value=='E-mail'){this.value=''};" onblur="if(this.value==''){this.value='E-mail'};"></div>
<div><input id="phone" name="phone" type="text" value="Phone" class="callforminput" style="margin:6px 10px 0px 0px" onfocus="if(this.value=='Phone'){this.value=''};" onblur="if(this.value==''){this.value='Phone'};"></div>
</form>
我不得不開啓我的PHP方法並使用一點CURL – Elliot 2010-11-11 18:39:21