如何在代码隐藏上调用 json 数据
How to call json data on code behind
<script type="text/javascript" language="javascript">
$(document).ready(function () {
var LastRecID = 1;
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
var ImpData = document.getElementById('<%= hdnLanguage.ClientID %>').value;
if (LastRecID <= 1)
sendData();
LastRecID++;
}
});
function sendData() {
$.ajax(
{
type: "POST",
url: "try.aspx/GetData",
data: ImpData ,
contentType: "application/json; charset=utf-8",
dataType: "json",
async: "true",
cache: "true",
success: function (msg) {
$("#myDiv").append(msg.d);
},
Error: function (x, e) {
alert("err");
}
});
}
});
</script>
我有隐藏的字段,它具有相同的价值。我为 hdnLanguage 设置 ImpData
var ImpData = document.getElementById('<%= hdnLanguage.ClientID %>').value;
我用 Json 发送数据:
data: ImpData
但是我不知道如何在代码隐藏(在静态 Web 服务中)调用这些数据 (ImpData)。谢谢你的回答。
data
将转换为GetData
参数。如果您发送这样的data
:
data: { param1: ImpData }
GetData
方法必须至少具有 param1
参数:
public static void GetData(string param1)
我找到答案
杰森:
data: "{'Param': '" + Param + "'}"
代码隐藏:
public static string GetData(string Param)
{
....
}
相关文章:
- Liferay:从portlet调用JSON服务
- 如何使用var名称调用JSON数据
- 调用JSON值时如何使用变量
- 按键名调用 JSON 对象的方法有什么区别
- 使用 jQuery 调用 JSON 对象中的元素
- 如何从字符串调用 json
- 405 AJAX 调用 JSON 时出错(xhr.status)
- 从 JavaScript 中的 URL 调用 JSON 文件
- 将异步 REST 调用 JSON 添加到 Angular $scope
- 如何在代码隐藏上调用 json 数据
- 如何通过 dojo 在 html 中调用 json rest 服务
- AngularJS计算函数中的字符串,以调用json列表上的属性
- 如何从JavaScript中调用Json对象
- 如何通过点击HTML按钮通过POST请求调用JSON
- 调用Json中的数组
- Three.js-多次调用JSON模型
- 如何从Angularjs模块调用JSON文件
- 未定义的ajax请求从rails应用程序调用json
- Google Geocharts-在调用json数据时获取相同大小的标记
- 如何从angularjs同步调用json数据