js传叁时 url参数过长导致被截掉了.因为是get提交方式

jay10509 2012-04-25 10:14:09
代码如下:
function showEmpDetailed(cmp,isAll,field,value){

var moreSQL = document.getElementById("moreSQL").value;
var url ='DetailedAction.do?isAll='+isAll+'&org='+cmp+'&field='+field+'&moreSQL='+moreSQL;
//alert(url)
if( value > 0 ){
var width = 1000;
var height = 600;
var left;
var top;
left=(window.screen.availWidth-width)/2;
top=(window.screen.availHeight-height)/2;
window.open( url , null,'left='+left+',top='+(top-100)+',width='+width+',height='+height+'status=yes,toolbar=no,menubar=no,resizable=yes,location=no');
}
}


上面代码moreSQL的值会很长很长、我现在传过去取来 一般都拿不到。现在我想问问大家有没好的建议。
我想要实际的实现代码.而不是说一句留言说:改成post提交。 如果是改成post提交 该怎么改。或者用其他方式传这个参数,该怎么写。。。求指教 、
...全文
698 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
freedom_gooboy 2012-04-25
  • 打赏
  • 举报
回复
1要用post来提交,数据量比get传输的大

可以用form表交 method是post

2.可以用jquery ajax来提交 具体可以看下jquery api(chm手册)网上搜索下就有
类似下面这样,可以试下


function showEmpDetailed(cmp,isAll,field,value){
jQuery.ajax({
url:'DetailedAction.do', //提交的url
type:'POST', // 使用post提交
data:{isAll_val:isAll,org_val:cmp,field_val:field,password:jQuery('#moreSQL').val()}, //提交表单数据
success:function(data){
//回调函数处理
#jQuery('#login_result').html(data);


}

});


if( value > 0 ){
var width = 1000;
var height = 600;
var left;
var top;
left=(window.screen.availWidth-width)/2;
top=(window.screen.availHeight-height)/2;
window.open( url , null,'left='+left+',top='+(top-100)+',width='+width+',height='+height+'status=yes,toolbar=no,menubar=no,resizable=yes,location=no');
}
}
jay10509 2012-04-25
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 的回复:]
If you wanted to use post to submit the request, you need to use the XMLHttpRequest (Ajax) or form element, for an example:

1. Use the Ajax to do the post:

jQuery.post("url", callback, {pars});
……
[/Quote]



用第二种不会弹出新窗口、我要的效果必须的window.open弹出新窗口的效果
tantaiyizu 2012-04-25
  • 打赏
  • 举报
回复
If you wanted to use post to submit the request, you need to use the XMLHttpRequest (Ajax) or form element, for an example:

1. Use the Ajax to do the post:

jQuery.post("url", callback, {pars});

2. Use the form element do the post:

var form = document.createElement("form");
form.action = "url";
form.method = "post";

Here you can create some input elements to store the values, like the input box, check box and etc..

form.submit();

document.body.appendChild(form);
jay10509 2012-04-25
  • 打赏
  • 举报
回复
上面的 一般都拿不到:改为:一半都拿不到、就是说我能传过去 但是在取出来时被截掉了很多。才取到这个字符串一半的值。
想念旧时光 2012-04-25
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 的回复:]
1要用post来提交,数据量比get传输的大

可以用form表交 method是post

2.可以用jquery ajax来提交 具体可以看下jquery api(chm手册)网上搜索下就有
类似下面这样,可以试下


JScript code


function showEmpDetailed(cmp,isAll,field,value){
jQuery……
[/Quote]

++

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧