jquery.load(“something.php”)运行不正常

时间:2015-06-10 02:23:51

标签: php jquery html

我有something.php,会打印dropdownlist选项,\

然后我用

加载.php文件
$("#dropdownlist").load("something.php");

加载后,显示输出,但是当我更改所选值时,在调试模式下,我没有在selected="selected"的选项上看到dropdownlist而我无法设置{{1使用

selectedvalue
dropdownlist

任何人都知道为什么会发生这种情况,我该如何解决?

附加代码

- $("#dropdownlist").val("2"); 上的打印选项 -

.php

---拨打while (isset($StatusArr[$loopCount])) { if ($loopCount == 0) { $selected = "selected='true'"; } else { $selected = ""; } echo "<option value='" . $StatusArr[$loopCount][0] . "' " . $selected . " >" . $StatusArr[$loopCount][1] . "</option>"; $loopCount ++; } ----

.js

1 个答案:

答案 0 :(得分:4)

vsDiffmerge.exe

此jQuery代码将下拉列表的选定选项设置为第二个选项。