简体   繁体   中英

Jquery Confirm not funtion in typescript

I know this has been asked before but I can't seem to find the answer, my jquery confirm not funtion, this problem in datatable with languange typescript angular 2, loadscript script have been declaration.

在此处输入图片说明

rows: {
  afterTemplate: function(row, data, index) {
    $('#delete-confirmation-dialog-' + data._id).on('click', function() {
      $.confirm({
        title: 'Delete?',
        content: 'Are you sure?',
        icon: 'fa fa-question-circle',
        animation: 'scale',
        closeAnimation: 'scale',
        opacity: 0.5,
        buttons: {
          'confirm': {
            text: 'Delete',
            btnClass: 'btn-red',
            action: function() {
              $.confirm({
                content: function() {

                  this.setTitle('Result');
                  this.setContent('Process...');

                  return $.ajax({
                    url: Urlapi + '/event/remove/' + data._id,
                    // headers: _self.jwt(),
                    dataType: 'json',
                    method: 'patch'
                  }).done(function(response) {
                    this.setContentAppend('<div>Done!</div>');
                    ( < any > $('.m_eventdatatable')).mDatatable('reload');
                  }).fail(function() {
                    this.setContentAppend('<div>Fail!</div>');
                  });
                },
              });
            }
          },
          cancel: function() {
            $.alert('Record canceled to delete');
          },
        }
      });
    });
  },
},

I'm new and not authorized for comments yet that's why didn't provide answer in comments.
Now lets move towards your problem i think you made a slightly mistake.


1)Adding jquery.js reference after jquery-confirm.js

Incorrect Way:

<script src="jquery-confirm-3.3.0.min.js"></script>
<script src="jquery.min.js"></script>

Correct Way:

<script src="jquery.min.js"></script>
<script src="jquery-confirm-3.3.0.min.js"></script>

OR
2)Spell mistake of filename or path.


If anything else please share your example source code... Thanks :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM