所以我有一個情況,我有一個選擇框,使一個.change事件的另一個腳本的jQuery .post調用。恢復selectbox選項返回如果
我想知道是否有反正我可以恢復selectedoption回到原來的默認值,如果發生或我的.post事件失敗?
嗨,我很抱歉。
這裏是javascript代碼。我對它做了一些修改。我試圖讓第二行工作,因爲由於一些錯誤(由於不知道第二行),此代碼現在不工作。我的選擇框是列表的一部分,所以我不能使它成爲唯一的ID並記住用戶選擇的框,我需要使用$(this)。
$('.order_stateselect').click(function(){
var val=$(this).find(":selected").val();
$(this).change(function(){
if(confirm('Confirm Order Status Change?')){
var conduct_status_chge=$.post('/seller/helpers/order_status_change.php',{order_item_id:$(this).parent('td').siblings('.order_item_id').text(),order_item_status:$(this).find(':selected').val()},function(data){
alert(data);
})
.error(function() { alert("error"); })
}
});
});
可能有,但沒有代碼我們應該怎麼知道?您可以至少發佈選擇列表和更改事件的代碼! – adeneo