I have a form to upload an image.
<% 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' %>
I have some Jquery to submit the form:
$(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;
},
});
});
});
I am getting the function called on change as I tried it with an alert. However the form is not submitting. Nothing happens. Can anyone see what it wrong?
Much appreciated.