You are on page 1of 1

javascript:function placeOrder() {var CouponCode = prompt("Enter the Coupon Code to

use.");var vCode = $('#hdnItemsCodesforCoupon').val();var MobileNumber =


prompt("Enter the mobile number where you want COD confirmation call without 0 or
+91");var addUpdate;var Name;var PinCode;var Address; var LandMark; var State; var
City; var areaid; var MobileNo; var AddressID; if(CouponCode && MobileNumber)
{$.ajax({url: "/checkout/getAddresssList",async: false,type: "GET",dataType:
"json",data: {},success: function (result) {addUpdate =
JSON.parse(result.result);if (result.success == true) {Name =
addUpdate[0].Name;PinCode = addUpdate[0].PinCode;Address =
addUpdate[0].Street1;LandMark = addUpdate[0].Street2;State =
addUpdate[0].StateId;City = addUpdate[0].CityId;areaid =
addUpdate[0].AreaId;MobileNo = MobileNumber;AddressID =
addUpdate[0].AddressId;}}});$.ajax({type: "GET",data: { mobile: "5014271110",
couponcode: CouponCode, variantcodes: vCode},url:
"/checkout/ValidateCoupons",async: false,contentType: "application/json;
charset=utf-8",dataType: "json",success: function (result) {var ds =
JSON.parse(result.result);if (ds != null){if (ds.Table[0].Status == 1)
{console.log("Wooohoooo!!!! "+CouponCode+" is working! Please wait while the order
is being placed......");$('#hdnMobileForCoupon').val(MobileNumber);$
('#hdnCouponAmount').val("500");$("#txtCouponCode").remove();$
('#couponSet').append("<input type='hidden' id='txtCouponCode'
value='"+CouponCode+"'/>");$('#btnMakePayment').click();{$.ajax({url:
"/myprofile/AddUpdateAddress",async: true,type: "POST",dataType: "json",data:
{ AddressId: AddressID, Name: Name, Pincode: PinCode, Address: Address, Landmark:
LandMark, StateId: State, Cityid: City, AreaId: areaid, Mobile: MobileNo },success:
function (result) {console.log("Address Changed Successfully!");}});}}else if
(ds.Table[0].Status == 10){alert(""+CouponCode+" is already used! Try with another
code.");}else if (ds.Table[0].Status == 2){alert(""+CouponCode+" is invalid, Check
the code again and try again!");}else if (ds.Table[0].Status == 12){alert("This
account/number is already used to place order with refer and earn coupon.");}}}});}
else {alert("Either Coupon Code or Mobile Number not entered."); return false;} }
placeOrder();

You might also like