I'm starting a web programming, because so far I used only to web design.
我正在开始一个web编程,因为到目前为止我只使用web设计。
My problem is that I´ve done a survey that show a form with 12 questions per department. The number of departments depends on a previous selector called "sections".
我的问题是,我´已经做的一项调查显示每个部门有12个问题。部门的数量取决于以前的选择器,称为“节”。
Thus, the form can show 12 questions fields if "section" has 1 department, or 120 if "section" has 10 departments.
因此,如果“section”有1个部门,或者120个“section”有10个部门,表单可以显示12个问题字段。
I serialize and encode data to Base64 before submit:
在提交之前,我将数据序列化并编码为Base64:
// Setup call
$.ajax({
type: 'GET',
url: 'survey_actions.php&action=save',
data: { parameters: Base64.encode($("#mySurvey").serialize()) },
dataType: 'text',
beforeSend:function(){
// Load waiting panel
loader("on");
},
success:function(response){
[...]
I´m sure this is not the clean method and for that I am experiencing the following problem: when the number of fields to fill is low (for example 12), all works OK, but when the number is higher (for example 72), no all data is received by server.
´我确定这不是我经历的清洁方法和以下问题:当字段的数量来填补低(例如12),所有的好工作,但是当数量较高(例如72),没有收到的所有数据服务器。
The fields are named as follows: "sectorID_questionID". So on post, params string is:
字段的命名为:“sectorID_questionID”。在post中,params字符串是:
...&1_0=X&1_1=X&1_2=X&1_3=X...
(X is the value that the user has given to the question).
(X是用户给出的问题的值)。
So the question: what is the most appropiated way to solve it and send huge data to the sever using AJAX without get it trimmed?
因此,问题是:什么是最接近解决它的方法,并使用AJAX将大量数据发送给服务器,而不让它被删除?
Sincerely, thanks for your help :)
衷心感谢您的帮助
3 个解决方案
#1
0
Ajax can only take data in a query string. So, if large data is not being sent properly, it may be a limitation of your server/application.platform. You may very well look into increasing the max_input_vars. And also make sure you use POST and not GET
Ajax只能在查询字符串中获取数据。因此,如果没有正确地发送大数据,则可能是服务器/应用程序的限制。您可能非常希望增加max_input_vars。还要确保你使用POST而不是GET。
#2
2
Change the ajax type to POST
, rather than GET
and get the data from $_POST
. Your data could be going above the maximum query string length.
将ajax类型改为POST,而不是从$_POST获取和获取数据。您的数据可以超过最大查询字符串长度。
#3
0
$.ajax({
type: "POST",
url: "some.php",
data: { name: "John", location: "Boston" }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
Just use the above syntax an I don't think you need to serialize your data
使用上面的语法,我认为您不需要序列化您的数据。
#1
0
Ajax can only take data in a query string. So, if large data is not being sent properly, it may be a limitation of your server/application.platform. You may very well look into increasing the max_input_vars. And also make sure you use POST and not GET
Ajax只能在查询字符串中获取数据。因此,如果没有正确地发送大数据,则可能是服务器/应用程序的限制。您可能非常希望增加max_input_vars。还要确保你使用POST而不是GET。
#2
2
Change the ajax type to POST
, rather than GET
and get the data from $_POST
. Your data could be going above the maximum query string length.
将ajax类型改为POST,而不是从$_POST获取和获取数据。您的数据可以超过最大查询字符串长度。
#3
0
$.ajax({
type: "POST",
url: "some.php",
data: { name: "John", location: "Boston" }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
Just use the above syntax an I don't think you need to serialize your data
使用上面的语法,我认为您不需要序列化您的数据。