views:

26

answers:

0

Hello guys,

i have a webservice checking if a user is connected:

[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public bool IsConnected(BasePage basePage)
{
    bool IsConnected = basePage.User.UserId != 0;
    return IsConnected;
}

BasePage is the parent of all my asp.net pages:

public class BasePage : System.Web.UI.Page and have a Class User Property.Anyway!

in an page inheriting BasePages i want to check if a use is connected. After i want to use a bool IsConnected where i put the result in a other javascript function.

Like that:

$(function() {
    var Connected = IsConnected(); //Result of calling webservice.

    if (Connected == "False") {
        //Code goes here
    }
});

Can someone show me simple example like that(sum(int a, int b)==>Use the resultt.

Thanks in advance.