$(document).ready(function() { function f_selection_show(){
$.ajax({
type: "post",
url: "fileadmin/f_ergebnisliste.php",
success: function(msg){
$("#sel_orte").find("option").each(function(i){
alert("ok"); // 只有加了alert,页面才能正常显示
var RadioId = "#radio_" + IgnoreSpaces($(this).val());
if($(RadioId).attr("src") === "../fileadmin/images/karte/css/radio.png")
$(RadioId).attr("src", "../fileadmin/images/karte/css/radio_act.png");
var CheckId = "#check_" + IgnoreSpaces($(this).val());
if($(CheckId).attr("src") === "../fileadmin/images/karte/css/check.png")
$(CheckId).attr("src", "../fileadmin/images/karte/css/checked.png");
})
},
error: function(jqXHR, exception) {
if (jqXHR.status === 0) {
alert('Not connect.\n Verify Network.');
} else if (jqXHR.status == 404) {
alert('Requested page not found. [404]');
} else if (jqXHR.status == 500) {
alert('Internal Server Error [500].');
} else if (exception === 'parsererror') {
alert('Requested JSON parse failed.');
} else if (exception === 'timeout') {
alert('Time out error.');
} else if (exception === 'abort') {
alert('Ajax request aborted.');
} else {
alert('Uncaught Error.\n' + jqXHR.responseText);
}
}
});
}f_selection_show();});只有加了alert,页面才能正常显示。 试过setTimeout的方法,无效! 请高手给指点一下!!!
$.ajax({
type: "post",
url: "fileadmin/f_ergebnisliste.php",
success: function(msg){
$("#sel_orte").find("option").each(function(i){
alert("ok"); // 只有加了alert,页面才能正常显示
var RadioId = "#radio_" + IgnoreSpaces($(this).val());
if($(RadioId).attr("src") === "../fileadmin/images/karte/css/radio.png")
$(RadioId).attr("src", "../fileadmin/images/karte/css/radio_act.png");
var CheckId = "#check_" + IgnoreSpaces($(this).val());
if($(CheckId).attr("src") === "../fileadmin/images/karte/css/check.png")
$(CheckId).attr("src", "../fileadmin/images/karte/css/checked.png");
})
},
error: function(jqXHR, exception) {
if (jqXHR.status === 0) {
alert('Not connect.\n Verify Network.');
} else if (jqXHR.status == 404) {
alert('Requested page not found. [404]');
} else if (jqXHR.status == 500) {
alert('Internal Server Error [500].');
} else if (exception === 'parsererror') {
alert('Requested JSON parse failed.');
} else if (exception === 'timeout') {
alert('Time out error.');
} else if (exception === 'abort') {
alert('Ajax request aborted.');
} else {
alert('Uncaught Error.\n' + jqXHR.responseText);
}
}
});
}f_selection_show();});只有加了alert,页面才能正常显示。 试过setTimeout的方法,无效! 请高手给指点一下!!!
echo '<select id="sel_orte" class="chosen chzn-done" multiple="true" >';
foreach($_SESSION['sel_orte'] as $value){
echo '<option select="selected" value="'.utf8_decode($value).'">'.utf8_decode($value).'</option>';
}
echo '</select>';
} else {
$_SESSION['sel_orte'] =NULL;
unset($_SESSION['sel_orte']);
}