Trying to get a json result back from method in another namespace, having issues

Posted by Blankman on Stack Overflow See other posts from Stack Overflow or by Blankman
Published on 2010-05-11T15:34:49Z Indexed on 2010/05/11 15:44 UTC
Read the original article Hit count: 334

Filed under:
|
|
|

I have a seperate .js file and namespace for json requests. I have another .js file and namespace for the actual logic.

I can't seem to get the result back in my logic layer.

var jsonResult = Blah.Data.LoadAggregates();

alert(jsonResult);
alert(jsonResult.d.length);
alert(jsonResult.length);

all of the above calls are returning undefined.

Blah.RegisterNamespace("Blah.Data");

(function(Data) {


    Data.LoadAggregates = function() {

        $.ajax({
            type: "POST",
            url: "asdf.asmx/GetAggregates",
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(data) {
                ???????

            },
            error: function(msg) {
                alert("error" + msg);
            }
        });

    };

})(Blah.Data);  

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery