HTTP错误414请求URL太长 [英] HTTP Error 414. The request URL is too long
问题描述
我使用ckeditor的格式化我的文本域里面的一些数据
I am using ckeditor to format some data inside my textarea
<textarea id="editorAbout" rows="70" cols="80" name="editorAbout"></textarea>
现在,当我尝试使用发布此数据 jQuery.ajax
这样,
Now when i try to post this data using jQuery.ajax
like this,
var about=escape( $("#editorAbout").text());
$.ajax({
type: "POST",
url: "../Allcammand.aspx?cmd=EditAboutCompany&about="+about,
type:"post",
async: false ,
success: function(response){
},
error:function(xhr, ajaxOptions, thrownError){alert(xhr.responseText); }
});
我得到的错误
I get the error
HTTP错误414请求URL太长。
HTTP Error 414. The request URL is too long.
我在这里得到的错误: http://iranfairco.com/example/errorLongUrl.aspx一>
试着点击修改文本按钮左下方的页面。
I am getting the error here: http://iranfairco.com/example/errorLongUrl.aspx
Try clicking on the Edit Text button at the bottom left of that page.
这是怎么回事?我该如何解决呢?
Why is this happening? How can I solve it?
推荐答案
据的这个问题 URL的最大实际长度为2000个字符。这不会是能容纳一个巨大的维基百科的文章一样,你要发送。
According to this question the maximum practical length of a URL is 2000 characters. This isn't going to be able to hold a massive Wikipedia article like you're trying to send.
。您需要添加一个数据
价值,你传递给Ajax调用函数的对象。像这样的:
Instead of putting the data on the URL you should be putting it in the body of a POST request. You need to add a data
value to the object you're passing to the ajax function call. Like this:
function editAbout(){
var about=escape( $("#editorAbout").text());
$.ajax({
url: "Allcammand.aspx?cmd=EditAboutCompany&idCompany="+getParam("idCompany"),
type:"post",
async: false,
data: {
about: about
},
success: function(response){
},
error:function(xhr, ajaxOptions, thrownError){alert(xhr.responseText); ShowMessage("??? ?? ?????? ??????? ????","fail");}
});
}
这篇关于HTTP错误414请求URL太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!