How to pass a value in jQuery
<p>I want to pass an error message. How do I do it and what do I need to change?</p>

<pre><code>    success: function(data) {
      var div = $('&lt;div&gt;').attr('id', 'message').html(data.message);
      if (data.success == 0) {
        $.modaldialog.error('The operation failed.');

        ...
</code></pre>

<p>I want to replace the <code>div</code> with the error message that comes into this success function. I still need the id though I think because it is what toggles between the success and error block.</p>

<hr>

<p>'The operation failed.' should be replaced with the error message that is contained in 'data.message'.</p>
