Rails 2.3.4 and jquery form plugin works on development, not in production?

Posted by hemajang on Stack Overflow See other posts from Stack Overflow or by hemajang
Published on 2009-10-05T22:45:59Z Indexed on 2010/05/05 0:08 UTC
Read the original article Hit count: 191

Filed under:
|
|
|
|

Hello, i'm trying to build a contact form in Rails 2.3.4. I'm using the jQuery Form plugin along with this (http://bassistance.de/jquery-plugins/jquery-plugin-validation/) for validations. Everything works in my development environment (mac os x snow leopard), the loading gif appears and on my log the email gets sent and the "request completed" notice shows. But on my production machine the loading gif just keeps going and the form doesn't get sent. I've waited as long as I could, nothing.

Here is my code:

/public/javascripts/application.js


 // client-side validation and ajax submit contact form 
 $('#contactForm').validate( {
  rules: {
   'email[name]': { required: true },
   'email[address]': {
    required: true,
    email: true
   },
   'email[subject]': {
    required: true
   },
   'email[body]': {
    required: true
   }
  },
  messages: {
   'email[name]': "Please enter your name.",
   'email[address]': "Please enter a valid email address.",
   'email[subject]': "Please enter a subject.",
   'email[body]': "Please enter a message."
  },
  submitHandler: function(form) {
   $(form).ajaxSubmit({
    dataType: 'script',
    beforeSend: function() {
     $(".loadMsg").show();
    }
   });
   return false;
  }  
 });

I'm using the submitHandler to send the actual ajaxSubmit. I added the "dataType: "script" and the "beforeSubmit" for the loading graphic.


  def send_mail
    if request.post?
      respond_to do |wants|
        ContactMailer.deliver_contact_request(params[:email])
        flash[:notice] = "Email was successfully sent."
        wants.js
      end
    end
  end

Everything works fine on development, but not in production. What am I missing or did wrong?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about jQuery