Я пытаюсь получить данные своего веб-сервиса в формате json, например ниже:
Imports System.Web
Imports System.Web.Script.Services
Imports System.Web.Services
Imports System.Web.Services.Protocols
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()>
<WebService(Namespace:="http://tempuri.org/")>
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Public Class WebService
Inherits System.Web.Services.WebService
<WebMethod()>
Public Function GetAllRss() As List(Of Rss)
Dim db As EMCEntities1 = New EMCEntities1()
Dim RssList As List(Of Rss) = db.Rss.ToList()
Return RssList
End Function
End Class
ajax:
$.ajax({
type: "POST",
url: "/WebService.asmx/GetAllRss",
success: function (result) {
console.log(result);
}
});
В этом случае я получаю данные в формате XML?
Как это сделать?