coupon.js 923 Bytes
define(function( require, exports, module ) {

  var _Coverbox = require('coverbox')();
  require( 'fancybox' );
  require( 'validate' );
  require( 'validate.extend' );

  jQuery.validator.addMethod("coupon", function(value, element) {
    var rs = false;
    $.ajax({  
        type: 'GET',
        url:'../cou.json',  
        async: false,
        success: function(data){  
          for (var i=0,l=data['coupon'].length;i<l;i++){
            if (value == data['coupon'][i]){
              rs = true;
            };
          }
        },
        error: function(data){}
    });  
    return rs;
  }, "抱歉该兑换码不存在,请重新输入");  

  $(".act-exchange").fancybox({
    padding: 0,
    scrolling: 'visible'
  })

  //require.async(['validate.extend'], function() {
    $(".k-validate").validate({

    });
  //});

  $(".actsub").click(function(){
    _Coverbox.tell('兑换成功!');
  });

});