1
我有一個Json文件和JavaScript文件中的ajax調用。嘗試使用Hello World asmx文件模板編寫正確的webservice方法。爲了在網站上顯示/返回/閱讀json數據,我應該在方法中寫什麼?使用Webservice調用外部Json文件使用Ajax調用
$(document).ready(function() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "http://localhost:56537/WebService.asmx/HelloWorld",
data: "{}",
dataType: "json",
success: function (Result) {
debugger;
Result = Result.d;
var data = [];
var dataResource = response
,您仍然可以使一個ASMX Web服務,但它確實是不支持通過Microsoft多更多。更好地使用WCF服務應用程序。您可以使用DataContractJsonSerilizer。 –
感謝您的提示! –