0
如何通过调用webservice的jQuery的...我试过下面的代码..如何通过jquery调用Webservice?
$(document).ready(function() {
$("#sayHelloButton").click(function(event){
$.ajax({
type: "POST",
url: "C:/Webservice/Service.asmx/HelloToYou",
data: "{'name': '" + $('#name').val() + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
AjaxSucceeded(msg);
},
error: AjaxFailed
});
});
});
function AjaxSucceeded(result) {
alert(result.d);
}
function AjaxFailed(result) {
alert(result.status + ' ' + result.statusText);
}
我怀疑是我的Web服务应该是什么?我是否需要发布,并使用该路径或服务应该是相同的解决方案中..
PLZ,清除我的疑问
web服务应该与javascript文件来自同一个域,所以url只是url:“Service.asmx/HelloToYou” – 2010-01-30 05:48:38