API:需要 jquery-serialize-object 才能将表单数据添加到现有数据对象(语义 UI)

API: jquery-serialize-object is required to add form data to an existing data object (Semantic UI)

基于http://semantic-ui.com/behaviors/api.html#/usage,我认为我的代码实际上运行。

这是代码:

$('#new-modul').form({
  fields: {
    division: {
      identifier: 'division',
      rules: [
        {
          type   : 'empty',
          prompt : 'Please select division'
        }
      ]
    },
    application: {
      identifier: 'application',
      rules: [
        {
          type   : 'empty',
          prompt : 'Please select application'
        }
      ]
    },
    title: {
      identifier: 'title',
      rules: [
        {
          type   : 'empty',
          prompt : 'Please enter a title'
        }
      ]
    },
    description: {
      identifier: 'description',
      rules: [
        {
          type   : 'empty',
          prompt : 'Please enter description'
        }
      ]
    }
  }
})
.api({
  url: './ajax/Ticket/new.php',
  method: 'POST',
  serializeForm: true,
  onComplete: function() {
    completeCreateNewModuleAction();
  }
});

但可能出了什么问题,所以这个错误出现在我的控制台上。

Error:

API: jquery-serialize-object is required to add form data to an existing data object

我也不知道为什么。

您需要包括 https://github.com/macek/jquery-serialize-object as stated in docs

基于http://semantic-ui.com/behaviors/api.html#/usage,查看传递数据部分。

路由表单数据中,它告诉我们:

Structured form data requires including macek's serialize object.


但是为了您的快捷方式信息,这是我执行的步骤:

第一个:

Download JQuery for Serialize Object in here and then save to your local file.

Add as internal javascript, so it can lighten your page.


第二个:

Include that file to your page :

<script src="link_to_your_file/jquery.serialize-object.min.js"></script>