Friday, March 2, 2018

Undefined Values in JS is not posted In AJAX Requests





In following JS code
function saveLTDrowConv(parent){
                pad_id =$('select[name="department1"] option:selected').val();
                 year =$('select[name="ReviewYear"] option:selected').val();
                 Deanrecommd = parent.find('.term_CONV_Dean').val();
                 conv  = parent.find('.term_CONV').val();
                 fte = parent.find('.term_CONV_fte').val();
                 sfu_id  = parent.find('.sfuid').html();
                 var filter = {

                        "pad_id":pad_id,
                        "year":year,
                        "sfu_id":sfu_id,
                        "fte":fte,
                        "Deanrecommd":Deanrecommd,
                        "conv":conv

                }
                 parent.find('.ltd_CONV_row').attr('disabled','disabled');
                 $.post("/tracs/ajax/facultyHiringPlan_ajax/saveLTDrowConv",  {"post":filter
                        }, function(data) {
                 
                        parent.find('.ltd_CONV_row').removeAttr('disabled');

                        $("div#notice").html('Update successfully.');
                        $("div#notice").css('display', 'block');
                        $("div#notice").fadeOut(5000);  


                });
}

If  Deanrecommd is undefined and  we post Deanrecommd, the server will not receive
Deanrecommd. i.e no $post['Deanrecommd']  in server. So as to other post variables.

No comments:

Post a Comment