0
您好我有一个水龙头/点击事件中的ajax请求的问题,它不适用于android webview。如果我在设备上使用chrome运行我的web应用程序链接,并且PC一切正常。我在我的应用程序中删除了ajax函数和重定向工程之后尝试了该函数。其他Ajax请求在应用程序中正常工作。它看起来像内部或ajax函数负责。我在活动中使用jQuery Mobile的1.4.5ajax请求内点击功能扰乱执行
我的WebView设置:
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>
这没有任何区别的朋友。 :( – Bodoppels
噢原谅我在测试时犯了一个错误,现在点击事件起作用了,谢谢!!没有注意到这可能是造成这种情况的原因。 – Bodoppels