var pams = []; var customer = encodeURIComponent($.trim($('#customer').val())); var age = $('#age').val(); var gender = $('#gender').val(); pams.push($('<input>', {name: 'age', value: age})); pams.push($('<input>', {name: 'customer', value: customer})); pams.push($('<input>', {name: 'gender', value: gender})); pams.push($('<input>', {name: 'backurl', value: encodeURIComponent('/user/new')})); $('<form>', { method: 'post', action: '/user/add.do' }).append(pams).submit();