I wasted 3 hours searching for the right syntax. How can i get the value of "prop_id" in javascript.
view -
<input type="hidden" name="prop_id" value="<?=$prop_id_inserted?>">
javascript
function upload_docu_by_type(prop_id, input, filetype) {
var fd = new FormData();
var fileInputs = $("." + input);
$.each(fileInputs, function (i, fileInput) {
if (fileInput.files.length > 0) {
$.each(fileInput.files, function (k, file) {
fd.append('images[]', file);
});
}
});
fd.append("prop_id",input);
fd.append("file", filetype);
$.ajax({
type: "POST",
url: base_url + "applicant_w/upload_docu_by_type",
data: fd,
dataType: 'json',
contentType: false,
processData: false,
success: function (response) {
}
})
controller
public function upload_docu_by_type() {
$this->load->helper(array('form', 'url'));
$F = array();
$prop_id = sanitize($this->input->post('prop_id'));
$file = sanitize($this->input->post('file'));
i want to get it in controller.