从文本文件逐个动态下拉

时间:2018-03-08 08:49:45

标签: jquery html drop-down-menu

逐个加载下拉,当我选择第一个下拉时,我可以加载第二个下拉,当我选择第二个下拉,第三个必须加载但失败

我的代码:

HTML

<option value="Mobile Phone">Mobile Phone</option>
<option value="Tablet">Tablet</option>
<option value="Accessories">Accessories</option>

脚本:

<option value="Nokia">Nokia</option>
<option value="aple">apple</option>
<option value="sony">sony</option>

Mobile.txt

// form-data
{
  template_id: 12345,
  username: "username",
  password: "password",
  boxes[0][type]: "text",
  boxes[0][text]: "lowercase top string",
  boxes[0][force_caps]: 0,
  boxes[1][type]: "text",
  boxes[1][text]: "lowercase bottom string",
  boxes[1][force_caps]: 0,
}

移动电话.txt

df['difference'] = [i.replace(j, '') for i, j in zip(df.raw, df.preprocessed)]

df    
                              raw      preprocessed      difference
0  helpersstreet 46, second floor  helpersstreet 46  , second floor
1              489 john doe route    john doe route            489 
2               at main street 49       main street          at  49

1 个答案:

答案 0 :(得分:2)

您应该使用encodeURIComponent广告网址进行编码,因为空格的存在可能会破坏此功能。

<强>代码:

$("#text-two").change(function () {
    $("#text-three").show();
    var url = "textdata/" + $(this).val() + ".txt";
    url = encodeURIComponent(url);
    $("#text-three").load(url);
});