Update1:как позвонить междоменного WebService/WCF в JQuery
вот что я получаю, когда я скопировать и вставить URL службы в браузере IE:
HTTP: // MyServerName /myservices.svc?wsdl
- <wsdl:message name="ILodge_GetCountfor">
<wsdl:part name="parameters" element="tns:GetCountfor" />
</wsdl:message>
- <wsdl:message name="ILodge_GetCountfore">
<wsdl:part name="parameters" element="tns:GetCountfor" />
</wsdl:message>
- <wsdl:message name="ILodge_GetCountfor_Input">
<wsdl:part name="parameters" element="tns:GetCountfor" />
</wsdl:message>
- <wsdl:message name="ILodge_GetCountfor">
<wsdl:part name="parameters" element="tns:GetCountfor" />
</wsdl:message>
HTTP: //myservername/myservices.svc XSD = xsd0
- <xs:element name="GetCountfor">
- <xs:complexType>
- <xs:sequence>
<xs:element minOccurs="0" name="GetCountforResult" type="xs:long" />
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="GetCountfor">
- <xs:complexType>
- <xs:sequence>
<xs:element minOccurs="0" name="Id" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="LevelId" type="xs:long" />
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="GetCountfor">
- <xs:complexType>
- <xs:sequence>
<xs:element minOccurs="0" name="GetCountfor" type="xs:long" />
</xs:sequence>
</xs:complexType>
</xs:element>
UPDATE:
я вижу услуги возвращает меня как XML:
public override string ToString()
{
//- <name>CLUE</name><desc>CLUE list</desc>
StringBuilder sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
sb.AppendLine("<kml xmlns=\"someSITE">");
sb.AppendLine("<FOLDER>");
sb.AppendLine("<name>Clue</name>");
sb.AppendLine("<desc>Clue list</desc>");
sb.AppendLine("</FOLDER>");
sb.AppendLine("</kml>");
return sb.ToString();
}
я попытался другой способ выполнения ниже перекрестных ссылок домена, но без успеха ... что я делаю неправильно здесь? я стараюсь отладки и поставить точку останова, но похоже, что это никогда не выполнится
$(document).ready(function() {
$.getJSON("http://servername/tools/myservice.svc/mymethod/?Id=1&callback=?", null,
function (result) {
alert("in test: " + result);
debugger
$("#spText").html(result);
});
OR
var path = "http://servername/tools/myservice.svc/mymethod?Id=1&callback=?";
$.ajax({
type: "GET",
url: path,
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
success: function (response) {
debugger
if (response != null) {
//displayData(response);
}
}
});
OR
debugger
$.ajax({ url: "http://servername/tools/myservice.svc/mymethod",
data: { Id: "1" },
dataType: "jsonp",
success: function (json, textStatus) {
alert(json.d);
alert(textStatus);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
debugger
}
});
OR
$.ajax({
type: "GET",
cache: false,
url: "http://servername/tools/myservice.svc/mymethod/Id=1&callback=?",
scriptCharset: "utf-8",
dataType: "jsonp",
data: parameters,
success: function (data, textStatus) {
debugger
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
debugger
}
});
}
Возможный дубликат [доступ запрещен с использованием jquery-1.4.1.js] (http://stackoverflow.com/questions/4146650/access-is-denied-using-jquery-1-4-1-js) – lonesomeday
Пожалуйста, отредактируйте существующие вопросы, а не публикуйте новые, когда они будут той же проблемой. – lonesomeday
Я не получаю доступ к отрицательной ошибке в размещенном вопросе. –