0
메트로 UI 앱을 시작하기 전에 json 데이터를 사용하여 반환하려고합니다. 내 웹 서비스가 json 데이터를 반환하지는 않지만 항상 XML 데이터를 retunr합니다. 일부는 이것에 도움이 될 수 있습니다.웹 서비스가 json 데이터를 반환하지 않습니다.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
var req = new XMLHttpRequest();
xmlhttp.setRequestHeader("Content-Type", "application/json");
function Roll() {
if (req.readyState == 4) {
alert(req.responseText);
alert("exiting");
}
}
function Test() {
alert("starting");
req.open("POST", "http://localhost:58718/testService/Service.asmx/HelloWorld", true);
req.onreadystatechange = Roll;
req.send(null);
}
</script>
</head>
<body>
<button onclick="javascript:Test()">TEST</button>
</body>
</html>
이 라인은 내 web.config 파일에 기본적으로 존재한다. 프레임 워크 버전 3.5를 사용하고 있습니다. – Kurkula