0

您好我有以下 jQuery.post 示例,需要知道如何使用 Windows 7 手机 SDK 发出相同的请求。

任何建议或指针都会被应用。

jQuery.post('http://URL',{
      'key':'4ec6975151b8ea0d768f8599541e2ee30fb20a93',
      'function':'getGroupMembers',
      'parameters':{    
        "group":{
            'group_id':'44',
            'user_id':'100003167624583'
        }
    }      
  },
function(res){
   console.log(res);   
},'json');
4

1 回答 1

0

WebClient.UploadStringAsync将发布一个字符串并返回结果。您可以使用JSON.NET(通过 NuGet 或手动下载)来序列化/反序列化:

WebClient client = new WebClient();

client.UploadStringCompleted += (s,e) =>
{
    var children = JToken.Parse(e.Result)["some_json_property"].Children();
    // continue here (but remember this is all asynchronous)
};

client.UploadStringAsync(
    new Uri("http://URI"),
    "POST",
    JsonConvert.SerializeObject(new
    {
        key = "4ec6975151b8ea0d768f8599541e2ee30fb20a93",
        function = "getGroupMembers",
        parameters = new {    
            group = {
                group_id = "44",
                user_id = "100003167624583"
            }
        }
    }));
于 2013-01-22T01:32:02.967 回答