如何在服务器端检索javascript函数的结果
How to retrieve the result of javascript function in the serverside?
我有javascript函数返回array
,如下所示:
<script type="text/javascript">
function looping() {
var column_num = 1;
var array = [];
$("#columns ul").not("#column1").each(function() {
var ulId = $(this).attr("id");
var ulClass = $(this).attr("class");
if (ulId != undefined && ulClass != undefined) {
var order = -1;
column_num++;
$("li", $(this)).each(function() {
var liId = $(this).attr("id");
var liClass = $(this).attr("class");
if (liId != undefined && liClass != undefined) {
order++;
var result = liId + "|" + liClass + "|" + column_num + "|" + order;
array.push(result);
//alert(array[0]);
}
});
}
});
return array;
}
</script>
如何在按钮单击事件中.cs
后面的代码中的另一个数组中检索结果?
我看到的唯一方法是使用POST或GET AJAX请求发送结果。
$.get("/server/page.aspx", { looping: looping() });
在服务器端do:
var array = Request.Params["looping"];
将数组存储在表单中的隐藏字段<input type="hidden" name="hidfld" id="hidfld" />
中。
document.getElementById("hidfld").value = array;
在服务器端,使用隐藏字段的名称检索数组
相关文章:
- JScript 错误: 无法分配给函数结果
- 显示基于javascript函数结果的HTML代码
- 访问来自另一个函数的函数结果
- 将函数结果传递给Javascript中的另一个函数变量
- NaN作为函数结果而不是必需的整数出现问题
- 更改javascript更改函数结果的颜色
- 从函数结果中检测三角函数
- 根据函数结果使用 JavaScript 更改图像
- 如何返回函数结果并将它们设置为标记的内部 HTML
- JavaScript 如何将函数结果与数组中的值一起传递到同一个函数中
- 用
标记包装 JQuery 函数结果
- 节点函数结果未定义
- 使用Cheerio和Response for Node web scraper,将响应函数结果传递给视图
- 在所有项目javascript中显示函数结果
- 平板电脑友好的悬停工具提示,显示基于javascript函数结果的动态文本
- 在机器时间更改后立即更新Date()函数结果
- 屈服函数结果
- 如何在JavaScript中处理异步函数结果
- 声明和定义全局变量作为函数结果有时有效
- Jquery&函数结果,作为属性名称