3
當我在HTTP Internet Explorer瀏覽器上運行我的代碼時,它工作正常。但是當我嘗試在HTTPS上運行相同的代碼時,我得不到預期的結果。帶有HTTPS的Jquery
這是我的代碼:
<!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>
我得到一個警告框,一個OK按鈕沿話說到這裏。但問題是當我點擊那個確定按鈕時,我什麼都沒有收到。理想情況下,我應該得到另一個警報框。
能幫我在這
在此先感謝
檢查Webdeveloper工具(F12)中的控制檯和網絡。 – Christoph 2012-07-10 07:18:02
如果你運行一個更加明確的'$ .ajax'調用,你可以添加錯誤回調函數,並且它有關於傳入錯誤的更多信息。 – TheZ 2012-07-10 07:20:38
在Chrome中查看控制檯中的標題,查找Access-Control-Allow-Origin選項。這在某些情況下會允許https工作,但是由於Internet Explorer和Opera不支持,據我所知,它不適用於這些瀏覽器。只有我能想到的事情? – adeneo 2012-07-10 07:41:55