2013-01-22 53 views
0

嗨,我有以下jQuery.post示例,並需要知道如何使用Windows 7電話SDK發出相同的請求。如何使用Windows 7電話SDK發出此請求

任何建議或指針將appriciated。

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

回答

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" 
      } 
     } 
    })); 
相關問題