开发者

Passing a JSON object to a function on server side, I get only [object Object]

I'm trying to create a JSON object on client-side and pass to a server-side function. Then instantiate it on serv开发者_StackOverflower-side using JSON string representation.

So I create jSON object on client-side

 var myJsonObject = {
        "arg1": var1,
        "arg2": var2
    }

and pass it in to

    WebForm_DoCallback(controlID, myJsonObject , null, null, null, true);

When I try to retrieve this JSON object on server-size I get as a string representation of JSON [object Object]

So in following server-side function, the argument value is [object Object]

public void RaiseCallbackEvent(string jsonObj)

I was expecting a string representation of JSON object. How do I pass in a string representation?


It needs to be serialized (stringified). Try this: https://github.com/douglascrockford/JSON-js/blob/master/json2.js.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜