我想通过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