为什么"未捕获的ReferenceError:populateDetailsForEditForm未定义"即将到来的@ frontend?

时间:2016-09-01 09:45:16

标签: javascript jquery bootstrap-modal

此代码位于我的一个JS文件gatewayList.js中。在这个文件中,我有以下功能:

function loadDetailsForEdit(data){
    editGatewayDialog = BootstrapDialog.show({
        title: 'Edit Gateway',
        cssClass: 'modified-dialog',
        closeByBackdrop: false,
        closeByKeyboard: false,
        onshow: function(dialog) {
            populateDetailsForEditForm(data);
        },
        message: $('<div></div>').load(EDIT_FORM),
    });
}

上述功能调用populateDetailsForEditForm(data) 此函数在另一个JS文件中定义,其名称为editGateway.js

function populateDetailsForEditForm(gateway) {
    $('#editForm').show();
    $('#remarks').val(gateway.remarks);
}

但服务器无法从editGateway.js文件中找到此gatewayList.js文件。它在Chrome浏览器中出现以下错误:

  

未捕获的ReferenceError:未定义populateDetailsForEditForm

list.html

<div class="container-fluid">
  <div class="row"> 
    <div class="col-xs-12 dataGridTitle">
      Recent Gateway List
    </div> 
    <div class="col-xs-12" style="border: 1px solid #ADADAD; padding-top:10px"> 
      <table id="gatewayGrid" class="table table-striped table-bordered" cellspacing="0" width="100%"> 
        <thead>
          <tr>
            <th>Gateway Id</th> 
            <th>Gateway Name</th> 
            <th>Issuing Country</th>
          </tr> 
        </thead>
      </table>
    </div> 
  </div> 
</div> 
<script src="/administration/gateway/controller/editGateway.js"></sc‌​ript> 
<script src="/administration/gateway/controller/gatewayList.js"></sc‌​ript>

0 个答案:

没有答案