I am making use of .post()
quite extensively in my CMS
application. The example of working code below passes 13 (the most in my application) parameters to the processing.php
file which works fine.
When the need requires the passing of more parameters I have simply made use of the action
form property which also works fine.
However, I have an application where there is a need to pass 38 variables including large strings, but at the same time perform a check on the action file
and if the check fails I need to fire off a js confirmation alert
to continue or cancel.
I am not quite sure how to fire the js confirmation alert
from the processing.php
file and how to return to the originating file with the information entered into the form intact should the user cancel.
I do however understand how to accomplish this if I make use of .post()
.
My Question is:
Are there any limitations in the number of parameters one should send to a processing.php
through .post()
as written below or is there another approach I should take to handle the above described problem? And if so what would you 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");});
});