I am trying to get JSON data into a jQuery variable using ASP.NET (not MVC):
$(document).ready(function () { $('#calendar').fullCalendar({ events: GetEvents(start, end)
In MVC, it could just be events: "/Calendar/GetEvents/" , which will call the CalendarController GetEvents () method.
But since I am not using MVC, I started following this guide to try to call server methods from the client.
In the second stage, he tells me that for this you need to create a static method:
[System.Web.Services.WebMethod] public static string Message() { return "Hello from the server-side World!"; }
But I need to have access to non-static variables like Session[] inside the method, so I canβt understand how this approach will work.
Is there a better approach to getting JSON data extracted from an aspx.cs method that does not require a direct server-side call? Or is there a way to use a session that I don't know about?
source share