var myform = $('#myform');
// Find disabled inputs, and remove the "disabled" attribute
var disabled = myform.find(':input:disabled').removeAttr('disabled');
// serialize the form
var serialized = myform.serialize();
// re-disabled the set of inputs that you previously enabled
disabled.attr('disabled','disabled');
var data = [];
// here, we will find all inputs (including textareas, selects etc)
// to find just disabled, add ":disabled" to find()
$("#myform").find(':input').each(function(){
var name = $(this).attr('name');
var val = $(this).val();
//is name defined?
if(typeof name !== typeof undefined && name !== false && typeof val !== typeof undefined)
{
//checkboxes needs to be checked:
if( !$(this).is("input[type=checkbox]") || $(this).prop('checked'))
data += (data==""?"":"&")+encodeURIComponent(name)+"="+encodeURIComponent(val);
}
});
/**
* Alternative method to serialize a form with disabled inputs
*/
$.fn.serializeIncludeDisabled = function () {
let disabled = this.find(":input:disabled").removeAttr("disabled");
let serialized = this.serialize();
disabled.attr("disabled", "disabled");
return serialized;
};
function getcomment(item)
{
var data = $(item).serializeArray();
$(':disabled[name]',item).each(function(){
data.push({name: item.name,value: $(item).val()});
});
return data;
}