jQuery对话框的ajax加载

I am trying to load a form into a jquery dialog via ajax and I notice that for some reason in firebug, the request url contains soem bogus parameter..like.._=1283928792723, which causes the request to fail with a 406 not acceptible.

Interestingly enough this does not happen with other routes such as edit_user_path(current_user), but it does happen with post new and edit actions. weird

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>

In your example, it looks like the URI is being generated server side, i.e.

 new_user_post_path(current_user)

To test this out, try putting in the hard-coded URI and run up the script.

If you do this and the problem goes away, then the issue is actually with your server-side function rather than with jQuery.

If you still have a problem, you could try passing the data like this:

$('#showdialog').click(function() {
    $('#new_vt').load(
        "<%= new_user_post_path(current_user)%>",
        { name: "fake" },
        function() {
            $('#new_vt').dialog('open');
        }
    );
  return false;
});

This is how the additional data is passed in the example in the documentation.

http://api.jquery.com/load/

It appears that new_user_post_path(current_user) is returning the URL with a random number attached in the query string to prevent request caching. Inspect the new_user_post_path function and see if this is the case.