﻿
function getPostData(containerId) {
    var result = {};

    $.each($('#'+ containerId + ' input[type=hidden]'), function() {
        if ($(this).attr('value') != "") {
            result[$(this).attr('name')] = $(this).attr('value');
        }
    });

    $.each($('#' + containerId + ' input[type=text]'), function() {
        if ($(this).attr('value') != "") {
            result[$(this).attr('name')] = $(this).attr('value');
        }
        else result[$(this).attr('name')] = '';
    });

    $.each($('#' + containerId + ' input[type=checkbox]'), function() {

        if ($(this).is(':checked')) {
            result[$(this).attr('name')] = true;
        } else {
            result[$(this).attr('name')] = false;
        }
    });

    $.each($('#' + containerId + ' textarea'), function() {
        if ($(this).attr('value') != "") {
            result[$(this).attr('name')] = $(this).attr('value');
        }
    });


    $.each($('#' + containerId + ' select'), function() {
        result[$(this).attr('name')] = $(this).attr('value');
    });


    return result;

}

