调用Web服务,我不能够调用Web服务或正在显示任何警报:无法从网页视图
我的活动代码:
mWebView = (WebView)findViewById(R.id.webViewRootAciviy);
mWebView.setWebViewClient(new WebViewClient());
mWebView.setWebChromeClient(new WebChromeClient());
mWebView.loadUrl("file:///android_asset/splashscreen.html");
的html代码:
<html>
<body>
this is a demo html file.
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js">
$.ajax({
type: 'GET',
url: 'http://192.168.11.50/ar/service.svc/ProductCategories?$format=json',
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function (data)
{
alert("success");
},
error: function (error)
{
alert("error");
}
});
</script>
</body>
</html>
也给了互联网许可。请帮我看看我错过了什么。
编辑:
我们有自己的公司和业务服务器托管就可以了。我使用无线网络访问互联网,服务器也通过以太网电缆连接到同一个无线路由器。
更新:我不知道为什么会发生这种情况。由于创建的服务类型,问题出现了。该Web服务是使用WCF Data service
创建的,但是在使用普通的WCF Service
再次创建Web服务后,该URL现在工作正常。
对不起。不工作。 –
我在想什么? –
评论此行可能是工作原理 mWebView.setWebChromeClient(new WebChromeClient()); – anddevmanu