解决方案 »
- String 引用没有设置为 String 的实例。参数名: s
- 关于2个页面之间的数据输入与数据绑定问题?
- 如何动态包含HML文件到网页中 急
- 利用<INPUT FILE>怎麼完成上傳功能 馬上結貼
- 发第6次帖了,累了,再不行就放弃了,做一个使用次数的计数器就这么难吗?..
- LoveCherry老大,超难问题,进来帮帮忙啊!!
- 最简单的问题!(立即结帖)
- 请问,如何在把文件传服务器上不再需要建立虚拟目录
- 如何在包含页的后台代码中控制用户控件的属性?
- <asp:HyperLinkColumn 是否有<a href></a> 或<img一新效果的的 alt标记。
- td中如何解决长串英文字符自动换行?
- INSERT INTO 语句的语法错误。
$.ajax({
type: 'POST',
data: "content="+content,
url: "../../BasicInfo/ToExcel"
});
firebug调试post的效果:content=[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
.net后台接受:string result=Request.Params["content"];接受不到值?
function JsonToStr(json){
var strs = [];
strs.push("{");
for (var i in json) {
strs.push("\"");
strs.push(i);
strs.push("\"");
strs.push(":");
strs.push(TypeParse(json[i]));
strs.push(",");
}
if (strs.length > 1) {
strs.pop();
}
strs.push("}");
return strs.join("");
} function ArrayToStr(array){
var strs = [];
strs.push("[");
for (var i in array) {
strs.push(i);
strs.push(",");
}
if (strs.length > 1)
strs.pop();
strs.push("]");
} function TypeParse(obj){
if ($.isArray(obj)) {
return ArrayToStr(obj)
} else if ($.isFunction(obj)) {
return "{}";
} else if ($.isNumeric(obj)) {
return obj;
} else if ((typeof obj) == "string") {
return "\""+obj+"\"";
}else if((typeof obj) == "boolean"){
return obj;
}
else if ($.isEmptyObject(obj)) {
return "\"\"";
} else if ($.isPlainObject(obj)) {
return JsonToStr(obj);
}
return "\"\"";
}能转一些简单的
public ActionResult ToExcel(int? page, int? rows) {
page = page == null ? 1 : page;
rows = rows == null ? 1 : rows;
……
}
这样应该能获取page和rows的值,我这里是可以的,如果有更好的方法,希望回复。