我想通過ajax加載一個表單到一個jQuery對話框中,我注意到由於某種原因在螢火蟲中,請求url包含soem假參數..如.. = 1283928792723,這會導致請求與406不能接受失敗。jquery對話框ajax加載
有趣的是,其他路線(如edit_user_path(current_user))不會發生這種情況,但它在發佈新的和編輯操作時會發生。怪異
http://localhost:3000/users/96/posts/new?_=1283928792723&name=fake
var dialogOpts = {
modal: true,
bgiframe: true,
autoOpen: false,
height: 500,
width: 500,
draggable: true,
resizeable: true
};
$("#new_vt").dialog(dialogOpts); //end dialog
$('#showdialog').click(function() {
$('#new_vt').load(
"<%= new_user_post_path(current_user)%>",
"name=fake",
function() {
$('#new_vt').dialog('open');
}
);
return false;
});
<a href="#" class="" id="showdialog">
Show
</a>
<div class="" id="new_vt">
</div>
參數以javascript文字符號傳遞,所以它應該是'name:「假」(不等於號) – leepowers 2010-09-08 07:18:42
好吧,我嘗試了一個硬編碼的有效URL。我也嘗試將數據格式更改爲{name:'fake'},{name:fake},'',[],但它們都不起作用。我需要將數據作爲非對象傳遞,因爲如果數據是對象,函數會假設POST請求,事實上,甚至不需要傳遞任何數據。名稱=假只是一個測試。現在做什麼? – badnaam 2010-09-09 20:01:40
@ pygorex1 - 很對。調整示例。 – Fenton 2010-09-10 07:38:37