如何处理Json post方法 [英] how to handle Json post method
本文介绍了如何处理Json post方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
由于我是json的新手,所以我需要知道json是什么,以及json的post方法
而且还有一个要求,我在数据集中有某些数据,我已经使用
将其转换为json
Hi
Since i am new to json i need to know what is json and also the post method of json
and also there is a requirement in which i have certain data in dataset ans i have converted it to json using
string strjson = string.Empty;
strjson = Newtonsoft.Json.JsonConvert.SerializeObject(dsGetdetails);
和output(json)看起来像下面的一个
and the output(json) look like the below one
{"Table":[{"businessName":"Name","businessId":1234},{"businessName":"Name","businessId":1234}]}
现在如何在jvascript中使用上述json并使用post方法
now how to use the above json in the jvascript and use the post method
推荐答案
看看这个:
使用Jquery绑定Gridview [
Have a look at this:
Bind Gridview using Jquery[^]
This tutorial will show how to bind json data in Gridview
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
<script type="text/javascript">
function BindGridView() {
.ajax({ 输入:"POST", 网址:"Default.aspx/GetNames", 数据: "{}", contentType:"application/json", dataType:"json", 成功:功能(数据){ 对于(var i = 0; i < 数据. d.length; i ++) {
.ajax({ type: "POST", url: "Default.aspx/GetNames", data: "{}", contentType: "application/json", dataType: "json", success: function (data) { for (var i = 0; i < data.d.length; i++) {
( "#NamesGridView").append(< tr < td > "+ data.d [i].名字+ "/td < td > "+数据. d [i].年龄+ "/td < /tr > )); } } }) } < /script >
("#NamesGridView").append("<tr><td>" + data.d[i].FirstName + "</td><td>" + data.d[i].Age + "</td></tr>"); } } }) } </script>
这篇关于如何处理Json post方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文