Php jQuery在HTTPS Internet explorer上未按预期工作
当我尝试在除Internet explorer之外的任何其他WebBrowser上运行代码时,它工作正常。但是当我尝试在InternetExplorer上运行代码时,我确实会收到一个警告框,上面写着“这里”以及“确定”按钮。但问题是,当我点击OK按钮时,我什么也得不到。理想情况下,我应该得到另一个警报框Php jQuery在HTTPS Internet explorer上未按预期工作,php,ajax,jquery,Php,Ajax,Jquery,当我尝试在除Internet explorer之外的任何其他WebBrowser上运行代码时,它工作正常。但是当我尝试在InternetExplorer上运行代码时,我确实会收到一个警告框,上面写着“这里”以及“确定”按钮。但问题是,当我点击OK按钮时,我什么也得不到。理想情况下,我应该得到另一个警报框 <!DOCTYPE html> <html> <head> <script src="js/jquery-1.4.2.min.js">&l
<!DOCTYPE html>
<html>
<head>
<script src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#submit").click(function(event) {
alert("here");
$.post('process.php', {name:'test1',email:'test.com'}, function(data)
{
$('#results').html(data);
alert(data);
});
});
});
</script>
</head>
<body>
<form name="myform" id="myform" action="" method="POST">
<label for="name" id="name_label">Name</label>
<input type="text" name="name" id="name" size="30" value=""/>
<br>
<label for="email" id="email_label">Email</label>
<input type="text" name="email" id="email" size="30" value=""/>
<br>
<input type="button" name="submit" id="submit" value="Submit">
</form>
<div id="results"><div>
</body>
</html>
非常感谢您在这方面的任何帮助
编辑:我发现使用HTTP的Internet Explorer工作得非常好,但在使用HTTPS的Internet Explorer上却不行。将代码更改为
<form name="myform" id="myform" action="" method="POST" onsubmit="return validate(this);">
<label for="name" id="name_label">Name</label>
<input type="text" name="name" id="name" size="30" value=""/>
<br>
<label for="email" id="email_label">Email</label>
<input type="text" name="email" id="email" size="30" value=""/>
<br>
<input type="button" name="submit" id="submit" value="Submit">
</form>
<script>
function validate(elem){
$.post('process.php', {name:'test1',email:'test.com'}, function(data)
{
$('#results').html(data);
return true;
});
return false;
}
</script>
尝试使用jquery$.ajax使用$fomname.serialize方法发布表单数据
将按钮类型从submit更改为button,单击按钮后调用函数
像
删除submit上的函数调用
尝试此单击事件,因为提交按钮在逻辑上不正确。对于单击,您必须使用普通按钮和,为什么要使用旧版本的jQuery?我需要在程序中进行其他更改吗?
function submitYourForm()
{
$.ajax({
type: 'POST',
cache: false,
async:true,
url: 'your url',
data: $('#myform').serialize(),
success: function(data) {
alert(data);
}
});
}
<input type="button" name="submit" onclick="submitYourForm();" value="Submit" />