Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用Ajax将下拉列表转换为输入文本框_Php_Jquery_Ajax - Fatal编程技术网

Php 使用Ajax将下拉列表转换为输入文本框

Php 使用Ajax将下拉列表转换为输入文本框,php,jquery,ajax,Php,Jquery,Ajax,对不起,这个标题 如何将此代码从下拉列表修改为input textbox,以便从getCustomer.php代码填充input textbox,而不是填充下拉列表 function getOrgCodes() { $.ajax({ url: 'getCustomer.php', dataType: 'json' }) .done(function(orgInfo) { $(orgInfo).each(function(i,

对不起,这个标题

如何将此代码从下拉列表修改为input textbox,以便从getCustomer.php代码填充input textbox,而不是填充下拉列表

function getOrgCodes() {
    $.ajax({
        url: 'getCustomer.php',
        dataType: 'json'
    })
    .done(function(orgInfo) {
        $(orgInfo).each(function(i, orgdisplay) {
            $('<option>').val(orgdisplay.ORGANIZATION).text(orgdisplay.ORGANIZATION).appendTo( $('#deptId') );
        })
    });
}
函数getOrgCodes(){ $.ajax({ url:'getCustomer.php', 数据类型:“json” }) .done(功能(orgInfo){ $(orgInfo).每个(功能(i,orgdisplay){ $('').val(orgdisplay.ORGANIZATION).text(orgdisplay.ORGANIZATION.appendTo($('#deptId')); }) }); } 将
替换为

函数getOrgCodes(){ $.ajax({ url:'getCustomer.php', 数据类型:“json” }) .done(功能(orgInfo){ $(orgInfo).每个(功能(i,orgdisplay){ $('').val(orgdisplay.ORGANIZATION).appendTo($('#deptId'); }) }); } 更换后,您不需要该
.text(orgdisplay.ORGANIZATION)
.val(orgdisplay.ORGANIZATION)
将在文本框内设置值

请参阅此小型演示:

function getOrgCodes() {
    $.ajax({
        url: 'getCustomer.php',
        dataType: 'json'
    })
    .done(function(orgInfo) {
        $(orgInfo).each(function(i, orgdisplay) {
            $('<input type="text">').val(orgdisplay.ORGANIZATION).appendTo( $('#deptId') );
        })
    });
}