【问题标题】:Codekit Uglify.js 'Unexpected token punc' errorCodekit Uglify.js 'Unexpected token punc' 错误
【发布时间】:2013-06-24 02:51:38
【问题描述】:

我不确定我的语法/意外令牌错误在哪里

我在 jsfiddle 上的完整 jQuery 函数: http://jsfiddle.net/leongaban/gmRUa/


我得到的错误:

The following error information applies to that file: 

 'Unexpected token punc, expected punc',
  line: 160,
  col: 29,
  pos: 5212,

对应my jsfiddle的第30行} catch {的行

您注意到是什么导致了那里的错误吗?



功能:

//REGISTER
var wireRegisterForm = function (form) {

console.log('inside wireRegisterForm');
var $form = $(form);

//form being submitted
$form.find('button').unbind('click').bind('click', function () {
    if (WORLD.validation.validateRegisterForm($form)) {

        var params = {
            "email":$form.find('#register-email').val(),
            "firstName":$form.find('#register-firstname').val(),
            "lastName":$form.find('#register-lastname').val(),
            "password":$form.find('#register-password').val()
        };

        //fill params with parameters from form
        WORLD.networking.postToServerWithAjax('/login', params, function (response) {

            //check successful or not from response object
            try {
                var isSuccessful = response.wassuccessful;
                if (isSuccessful === true) {
                    loginSuccess();
                } else {
                    // login failed
                }
            } catch {
                // login failed
            }

        });

        }

        //stop the form submit
        return false;
    });

    //enter clicked from password box
    $form.find("input[name='password']").unbind('keyup').bind('keyup', function (event) {
        if (event.keyCode === 13) {
            this.find("button").click();
        }
    });
};

【问题讨论】:

    标签: jquery syntax-error uglifyjs codekit


    【解决方案1】:

    错误是我的catch语句是错误的......这是编写javascript catch的正确方法:

    catch(err)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-05
      • 2017-03-31
      • 1970-01-01
      • 1970-01-01
      • 2015-04-21
      • 1970-01-01
      相关资源
      最近更新 更多