title: jquery tools Overlay: Open an overlay on based on ajax response
body: <p>I am trying to open an overlay on a button click. The button has associated with it an ajax call, which if returns an error should open an overlay, but on success the overlay does not open.</p>
  
  <p>What happens is that the overlay opens regardless of success/error in ajax response. It opens on button click, not on ajax response. What am I missing here???</p>
  
  <p>Here is what I am trying...</p>
  
  <pre><code>//Overlay setup
  $('#PostQuestion').overlay({
      target: "#template"
  });
  
  //Ajax call setup
  $('#PostQuestion').click(function() {
      $.ajax({
          url: '/ask_away',
          dataType: "json",
          data: {question: 'something'},
          type: 'POST',
          cache: false,
          success: function(response) {
              alert("It was a success");
          },
          error: function(request, error) {
              $('#PostQuestion').data('overlay').load();
          }
      });
  });
  
  &lt;!-- HTML Here --&gt;
  &lt;div id="template"&gt;You got an error&lt;/div&gt;
  &lt;div id="PostQuestion"&gt;Ask Question&lt;/div&gt;
  </code></pre>