doufangpian5545 2018-08-07 11:26
浏览 86

如何在使用新FormData()时获取ID; 的JavaScript /笨

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.

  • 写回答

2条回答 默认 最新

  • dpq59734 2018-08-07 11:32
    关注

    Use below code snipped, hope it work for you!

    $("input[name='prop_id']").val();
    
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器