0
我有一個表單上傳圖像。jQuery ajax提交不起作用
<% remote_form_for(:avatar, :url => { :controller => "avatar", :action => "upload", :id => @tmp_id }, :html => { :method => :post, :id => 'uploadForm', :multipart => true }) do |f| %>
<%= f.file_field :image, :class => 'uploader' %>
我有一些jQuery來提交表單:
$(document).ready(function() {
$('.uploader').change(function(){
jQuery('#uploadForm').ajaxSubmit({
beforeSubmit: function(a,f,o) {
o.dataType = "json";
},
complete: function(XMLHttpRequest, textStatus) {
$('#user_image').attr('src', XMLHttpRequest.responseText);
return false;
},
});
});
});
我正在呼籲改變,因爲我有一個警告試了一下功能。但是表單不提交。什麼都沒發生。 任何人都可以看到它錯了嗎?
非常感謝。
謝謝。我做了更改,但似乎在嘗試提交表單時會掛起。 – chell 2011-03-14 05:46:20