How to delay 5 second before submission in Javascript
<p>I have javacript function.</p>

<pre><code>function validateAddToCartForm(object) {
   value = $(".product-detail-qty-box").val();
   if(!isInt(value) || value &lt; 1) {
           $(".product-detail-error").show();
           return false;
   } else {
           $(".product-detail-error").hide();

           var product_name = $("#product_detail_name").text();
           var NewDialog = $('&lt;div id="MenuDialog"&gt;\ ' + product_name + '&lt;/div&gt;');
       NewDialog.dialog({            
           modal: true,
           title: "title",
           show: 'clip',
           hide: {effect: "fadeOut", duration: 1000}
       });

   }
   return true;
}
</code></pre>

<p>Currently I need to suspend or delay 3 or 5 seconds before return true. Because I want to show New Dialog for a while. So how can I implement.</p>
