Javascript确认无法在函数内部工作

时间:2014-10-03 17:11:02

标签: javascript popup confirm

我有以下功能:

shoppingCart.prototype.submitOrder = function () {

var order_info = localStorage != null ? localStorage[this.cartName + "_items"] : null;

var confirm_order = confirm("Do you wish to confirm your order?");
if (confirm_order == true)
{
   $.post( "http://181.185.185.71/mywinelist/submitOrder", {"order":order_info})
      .done(function( data ) {
          alert( "Your order has been successfully submitted. Thank you!" );
  }); 

} else { alert("order cancelled");}


}

如果删除了confirm_order变量和if语句,并且如果删除了$ .post(并且替换了一个简单的警报),则.post工作正常,但它们将无法一起工作。任何帮助将不胜感激。提前致谢。

0 个答案:

没有答案