问题描述
我在一个项目中创建了Web服务,并尝试在同一台计算机上的另一个项目中调用该Web服务。使用$ .ajax我调用了该服务
函数CallService(){
$ .ajax({
类型:GET,
url:../ startervice.asmx / Hello World,
数据:'{}',
contentType:application / json; charset = utf-8,
dataType:json,
成功:OnSuccessCall,
错误:OnErrorCall
});
}
函数OnSuccessCall(响应){
$(#Responseserv)。text(response.d);
}
函数OnErrorCall(响应){
$( #Responseserv)。text(response.status ++ response.status.text);
}
给出错误500 ..
当我在Html项目中创建Web服务然后能够调用它。
但我想知道我怎么能在项目外调用Web服务..
I have created web service in one project and trying to call that web service in the other project on the same computer. Using $.ajax i called that service
function CallService() {
$.ajax({
type: "GET",
url: "../startservice.asmx/HelloWorld",
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccessCall,
error: OnErrorCall
});
}
function OnSuccessCall(response) {
$("#Responseserv").text(response.d);
}
function OnErrorCall(response) {
$("#Responseserv").text(response.status + " " + response.status.text);
}
giving error 500..
When i create the web service inside the Html project then able to call it.
but i want to know how i can call web service out side the project..
推荐答案
这篇关于如何在不同的项目中调用Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!