ajax 点击函数内的请求干扰执行
ajax request inside click function disturb execution
您好,我在点按/单击事件中的 ajax 请求有问题,该请求在 android webview 上不起作用。如果我 运行 我的 webapp link 和 chrome 在设备和电脑上都可以正常工作。我在删除 ajax 函数后尝试了该函数,然后在我的应用程序中进行了重定向。其他 ajax 请求在应用程序中运行良好。它看起来像是内部的东西或 ajax 函数负责。我使用 jquery 手机 1.4.5
我的网络视图设置 activity:
CookieManager.getInstance().setAcceptCookie(true);
mWebView = (WebView) findViewById(R.id.webview);
// Brower niceties -- pinch / zoom, follow links in place
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
mWebView.setWebViewClient(new GeoWebViewClient());
// Below required for geolocation
mWebView.getSettings().setAllowFileAccessFromFileURLs(true);
mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setGeolocationEnabled(true);
mWebView.setWebChromeClient(new GeoWebChromeClient());
我页面的片段
<ul data-role="listview" class="ul" id="uItem1" data-inset="true">
<?php foreach ($result as $key => $row): ?>
<li data-icon="false" class="listitem<?php echo $row['id']; ?>">
<a type="button" id="<?php echo $row['id']; ?>">
<h2>test</h2>
</a>
</li>
<script>
$(".listitem<?php echo $row['id']; ?>").on('tap', function() {
var chatid = <?php echo $row['id']; ?>;
$.ajax({
url: 'read.php',
data: {
chatid
},
type: 'POST',
success: function(output) {
alert(output);
}
});
window.location.href = 'chatview.php';
});
</script>
<?php endforeach; ?>
</ul>
data: { chatid }
格式不正确应该像
data: { chatid: 1 }
您好,我在点按/单击事件中的 ajax 请求有问题,该请求在 android webview 上不起作用。如果我 运行 我的 webapp link 和 chrome 在设备和电脑上都可以正常工作。我在删除 ajax 函数后尝试了该函数,然后在我的应用程序中进行了重定向。其他 ajax 请求在应用程序中运行良好。它看起来像是内部的东西或 ajax 函数负责。我使用 jquery 手机 1.4.5
我的网络视图设置 activity:
CookieManager.getInstance().setAcceptCookie(true);
mWebView = (WebView) findViewById(R.id.webview);
// Brower niceties -- pinch / zoom, follow links in place
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
mWebView.setWebViewClient(new GeoWebViewClient());
// Below required for geolocation
mWebView.getSettings().setAllowFileAccessFromFileURLs(true);
mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setGeolocationEnabled(true);
mWebView.setWebChromeClient(new GeoWebChromeClient());
我页面的片段
<ul data-role="listview" class="ul" id="uItem1" data-inset="true">
<?php foreach ($result as $key => $row): ?>
<li data-icon="false" class="listitem<?php echo $row['id']; ?>">
<a type="button" id="<?php echo $row['id']; ?>">
<h2>test</h2>
</a>
</li>
<script>
$(".listitem<?php echo $row['id']; ?>").on('tap', function() {
var chatid = <?php echo $row['id']; ?>;
$.ajax({
url: 'read.php',
data: {
chatid
},
type: 'POST',
success: function(output) {
alert(output);
}
});
window.location.href = 'chatview.php';
});
</script>
<?php endforeach; ?>
</ul>
data: { chatid }
格式不正确应该像
data: { chatid: 1 }