나는이 웹 서비스에 연결을 시도 :
을하지만
이것은에 "오류"경고 내가 사용한 스크립트 :
var varType;
var varUrl;
var varData;
var varContentType;
var varDataType;
var varProcessData;
function SetValue() {
varType = "POST";
varUrl = "http://www.w3schools.com/webservices/tempconvert.asmx/FahrenheitToCelsius";
varData = '{"Fahrenheit":"230"}';
varContentType = "application/json; charset=utf-8";
varDataType = "json";
varProcessData = true;
CallService();
}
function CallService() {
$.ajax({
type: varType,
url: varUrl,
data: varData,
contentType: varContentType,
dataType: varDataType,
processdata: varProcessData,
success: function (msg) {
ServiceSucceeded(msg);
},
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.statusText);
alert(thrownError);
}
});
}
function ServiceSucceeded(result) {
alert("ServiceSucceeded");
varType = null; varUrl = null; varData = null; varContentType = null; varDataType = null; varProcessData = null;
}
어떻게해야합니까?
(http://en.wikipedia.org/wiki/Same_origin_policy) –
의 크로스 도메인 요청을 할 때
dataType: 'jsonp'
을 사용해야합니다 당신은 모든 것을 'null'로 설정할 필요가 없습니다 ... 가비지 컬렉터가이를 처리합니다. – Ryan정확히 당신이 방화 광/webinspector로 돌아오고있는 것을 보았습니까? 사전 설정 변수를 사용하여 콘솔에서 수동으로 시도 했습니까? – alonisser