代码在PC上正常工作。但是在Windows手机(以及其他移动设备)上,ajax请求只触发一次:
<!DOCTYPE html>
<html lang='pl'>
<head>
<title>Oświetlenie - Esp8266</title>
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css'>
<script src='https://code.jquery.com/jquery-1.11.2.min.js'></script>
<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js'></script>
<meta charset='utf-8'>
<link href='https://gitcdn.github.io/bootstrap-toggle/2.2.0/css/bootstrap-toggle.min.css' rel='stylesheet'>
<script src='https://gitcdn.github.io/bootstrap-toggle/2.2.0/js/bootstrap-toggle.min.js'></script>
</head>
<body>
<div class='row'>
<div class='col-md-2 col-md-offset-5'>
<input type='checkbox' data-toggle='toggle' id='bulbswitch' name='bulb' >
</div>
</div>
<script type='text/javascript'>
$('#bulbswitch').on('change',function(){
$.ajax({ url: '/trigger',type: 'GET'});
});
</script>
</body>
</html>
我做错了什么,mobiel手机需要特殊的请求类型?
在ajax调用解决问题上添加cache:false
:)
答案 0 :(得分:0)
在ajax调用解决问题上添加cache:false
:)