javascript - Are there limitations to passing parameters through .post() in jquery -
i making use of .post() quite extensively in cms application. example of working code below passes 13 (the in application) parameters processing.php file works fine.
when need requires passing of more parameters have made use of action form property works fine.
however, have application there need pass 38 variables including large strings, @ same time perform check on action file , if check fails need fire off js confirmation alert continue or cancel.
i not quite sure how fire js confirmation alert processing.php file , how return originating file information entered form intact should user cancel.
i understand how accomplish if make use of .post().
my question is:
are there limitations in number of parameters 1 should send processing.php through .post() written below or there approach should take handle above described problem? , if suggest?
example of working code
// code element $( "#updatedefaultcodebutton" ).click(function(){ var url = $('#updatedefaultcodeurl').val(); var code_font_family = $('#code_font_family').val(); var code_font_color = $('#code_font_color').val(); var code_font_weight = $('#code_font_weight').val(); var code_font_size = $('#code_font_size').val(); var code_bg_color = $('#code_bg_color').val(); var code_pad_t = $('#code_pad_t').val(); var code_pad_r = $('#code_pad_r').val(); var code_pad_b = $('#code_pad_b').val(); var code_pad_l = $('#code_pad_l').val(); var code_w_pad_t = $('#code_w_pad_t').val(); var code_w_pad_r = $('#code_w_pad_r').val(); var code_w_pad_b = $('#code_w_pad_b').val(); var code_w_pad_l = $('#code_w_pad_l').val(); var postit = $.post( url, { code_font_family:code_font_family, code_font_color:code_font_color, code_font_weight:code_font_weight, code_font_size:code_font_size, code_bg_color:code_bg_color, code_pad_t:code_pad_t, code_pad_r:code_pad_r, code_pad_b:code_pad_b, code_pad_l:code_pad_l, code_w_pad_t:code_w_pad_t, code_w_pad_r:code_w_pad_r, code_w_pad_b:code_w_pad_b, code_w_pad_l:code_w_pad_l }); postit.done(function( data ) {window.location.replace("../generator.php?returnto=manage/global-styles-manage.php");}); });
jquery ajax doesn't have limits. request size limited on server trough various configurations depend on environment.
apache:
limitrequestbody, around 2gb default, maybe greater 64bits, check error logs details.
php:
post_max_sizedirectly related post sizeupload_max_filesizemay unrelated, not suremax_input_time, if post takes longmax-input-nesting-levelif data array lot of sublevelsmax_execution_time, quite sure it's not thatmemory_limit, may reach size exceding subprocess allowed memorymax_input_vars, if data array has many elements
taken from: https://stackoverflow.com/a/9691395/2853903
Comments
Post a Comment