我使用 (Jquery & PhoneGap) 创建了一个 android 应用程序。应用程序运行良好 现在,我想从我的 ASP.NET Web 服务中检索数据。
html:
<html>
<head>
<meta charset="utf-8">
<title>My Friends</title>
<link href="Jquery-mobile/jquery.mobile-1.1.0.css" rel="stylesheet" type="text/css" />
<script src="Jquery-mobile/jquery-1.4.1.js" type="text/javascript"></script>
<script src="Jquery-mobile/jquery.mobile-1.1.0.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
//code to fetch data from webservice
alert($("#test").html());
});
</script>
</head>
<body>
</body>
</html>
asp.net 网络服务
/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}