<script>
function sendForm() {
$.post("http://www.website.com/main/post.cfm",$("#testForm").serialize(),function(data,status){
$("#result").html(data)
});
return false
}
$(document).ready(function() {
$("#testForm").submit(sendForm);
});
</script>
以及 IFrame 的以下代码:
<form id="testForm" method="post">
<label for="subscriberEmail">Enter your email</label> <input id="subscriberEmail" name="subscriberEmail" type="text" required="yes" validate="email" message="Please enter a valid email address" class="replaceText" value="Enter your email"/>
<input id="subscribe" type="image" src="signup.png"/>
</form>
<div id="result"></div>
div.result 中不显示任何内容。但是,如果我使用 common action="http://www.website.com/main/post.cfm",它会成功返回重新加载整个 IFrame 的消息。
$.post 到 ColdFusion 页面会不会有问题?有什么解决方法或替代方法吗?