i have a something.php which will print the option of dropdownlist,\
then i load the .php file with
$("#dropdownlist").load("something.php");
after i load, the output is displayed, but when i change the selected value, in debug mode i din not saw a selected="selected" on the option of dropdownlist and i cannot set a selectedvalue to the dropdownlist also with
$("#dropdownlist").val("2");
any one know why this happen and how can i solve it?
add-on code
--print option on .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 ++;
}
---call in .js----
$('#select').load("../something.php", function (respond, fstatus, xhr) {
if (fstatus === "success") {
if (status !== "missing") {
$('#status').prop("selectedIndex", 3);
}
} else {
alert("Load data " + fstatus + "\n" + xhr.status + " " + xhr.statusText);
}
});