Adsense
Popular Posts
- Install APXS in Redhat Linux
- MySQL workbench -"Could not decrypt password cache"
- Transfer modules between sites
- JavaScript, remove trailing insignificant zeros after toFixed function
- Set Windows path command line
- datatable order by nunmeric
- MySQL date created and date modified
- super(props) in React
- PHP, dump varailbes in a format way
- React: connect(mapStateToProps, mapDispatchToProps)
Tuesday, January 19, 2016
disabled input in jQuery serializeArray();
If an input has attribute disabled, it will not be included in jQuery serializeArray();
To make it included in jQuery serializeArray(), we first make it enabled and disabled again
Example
var disabled_attr =$('#instructorname').attr("disabled");
if(disabled_attr=='disabled') $('#instructorname').removeAttr("disabled");
var postData = $("form").serializeArray();
if(disabled_attr=='disabled') $("#instructorname").prop("disabled", true);
To get serializeArray into post bvalue
dataObj = {};
for (i=0; i<len; i++) {
dataObj[postData[i].name] = postData[i].value;
}
Add more value, some of them from url get
postData.push({
name: "funct",
value: "saveGuidelineInfo"
}, {
name: "sid",
value: $.url.param('sid')
},{
name: "term",
value: $.url.param('term')
},{
name: "instr_section",
value: $.url.param('instr_section')
},{
name: "cid",
value: $.url.param('cid')
},{
name: "pad_id",
value: $.url.param('pad_id')
}
);
Final post data
$.post("../_ajaxParts/TA/SITAContractView.php", postData, function(data) {
formatJson(data, 'div#notice', null);
});
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment