title: drupal 7 prevent redirect in modal window (ctools) when submit
body: <p>I have placed a form (built with entityform) into a modal (ctools modal) using jquery.</p>
  
  <p>Now, what happens is that when I click on the "submit" button, I get redirected to another page where I display the "success" message.</p>
  
  <p>I'd like to avoid the redirect and display the "success" message within the modal (in the same page where the modal pop up).</p>
  
  <p>Thanks in advance.</p>
  
  <p>This is the jquery I used to launch the modal on click:</p>
  
  <pre><code>    (function ($) {
          Drupal.behaviors.tuo = {
  
      attach: function (context, settings) {
          $('#comments_button', context).click(function () {
  
          $('#suggerimenti').dialog('open');
  
          $('.ui-dialog-titlebar').append($('h2', '#block-views-invio-suggerimenti-block'));
  
          $('.ui-dialog-content').append($('form', '#block-views-invio-suggerimenti-block'));
  
      });
  
          $('#suggerimenti').dialog({
                  autoOpen:false,
                  minWidth:500,       
      });
  }
  </code></pre>
  
  <p>};
  })(jQuery);</p>
  
  <p>And this is the html of the form created by Drupal:</p>
  
  <pre><code>&lt;form id="prova-invio-entityform-edit-form" class="entityform entitytype-prova_invio-form" accept-charset="UTF-8" method="post" action="/tuo_tema_dev2/?q=content/blandit-ratis-usitas-valde"&gt;
  
      &lt;div&gt;
  
          &lt;div class="pre-intructions"&gt;&lt;/div&gt;
  
          &lt;div id="edit-field-suggerimento-new" class="field-type-text-long field-name-field-suggerimento-new field-widget-text-textarea form-wrapper"&gt;
  
          &lt;div id="edit-field-refer" class="field-type-entityreference field-name-field-refer field-widget-entityreference-autocomplete form-wrapper"&gt;
  
          &lt;div id="edit-actions--3" class="form-actions form-wrapper"&gt;
  
              &lt;input id="edit-submit--4" class="form-submit ajax-processed" type="submit" value="invia suggerimento" name="op"&gt;
  
          &lt;/div&gt;
  
      &lt;/div&gt;
  
  &lt;/form&gt;
  </code></pre>