我正在使用jquery的帖子,不知何故,似乎該帖子發佈兩次。我正在Android Broswer上測試這個。非常有線。有人知道爲什麼嗎?這是一個jQuery的bug或什麼?jquery發佈兩次?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="vendor/jquery-1.5.js"></script>
<title>Test Runners</title>
</head>
<body>
<h1>Test Runner</h1>
<script type="text/javascript">
post_result = function() {
console.log("post_result is called!");
$.post('http://192.168.2.3:8001', { 'jasmine-url' : "test url" ,'jasmine-content' : "test content" })
.success(function() { alert("second success"); return true; })
.error(function() { alert("error"); return true; })
.complete(function() { alert("complete"); return true; });
}
</script>
<a href="javascript:post_result()">post result</a>
</body>
</html>
更多信息:
做了一些改動原來的職位。
實際上,在我們第一次發佈post請求時,它只發出了兩個請求,一個是OPTION方法,另一個是POST。
但是在Android瀏覽器中,每次同一個代碼都會發兩個POST請求。我認爲使用Android瀏覽器的JQUERY可能存在問題。任何人都知道這一點?
顯示執行2個請求的Chrome開發人員工具的屏幕快照 – zerkms
我最近遇到了一些問題(廣泛報道),Chrome會令人驚訝地發出多個GET(空白'src'是一個示例),但從未使用POST。同意@zerkms,需要更多。 – Dan