Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 jquery 中有一个数组,我在运行时将值添加到这个数组。之后我将从 asp.net 页面访问这个数组,即:jquery:
var marker=[]; marker[0]='world'; marker[1]='sky';
ASP.NET:
string []values=new string[]; values[0]=marker[0]; values[1]=marker[1];
我该怎么做,有什么方法可以从 asp.net 页面访问 jquery veriables
您可以将这些值存储在 a 中hidden field并在后面的 asp.net 代码中读取它们
hidden field
这里的例子:
在后面的代码中获取 javascript 中设置的值
将值从代码隐藏传递到 Javascript
编辑
您可以将此数组传递给WebMethod使用 ajax 的帖子
WebMethod
JQuery AJAX 发布到 asp.net webmethod 永远不会被调用