• Resolved dejernet


    At the bottom of your assets/js/media.js file, you are parsing all AJAX calls looking for a data value containing “action=delete-post” and resetting a counter when it’s found. The problem is that settings.data is not always a string, and will throw an error when it’s not. I develop custom plugins and use AJAX calls all the time. If formData is submitted via AJAX, which is done via the data setting, your code is kicking back an “Uncaught TypeError: settings.data.indexOf is not a function”. I would recommend a slight alteration to your code to make sure settings.data is a string before attempting indexOf. Adding “typeof settings.data == ‘string'” should do the trick.

    jQuery( document ).ajaxComplete(function( event, request, settings ) {
    if(settings.data != undefined && typeof settings.data == ‘string’ && settings.data.indexOf(“action=delete-post”)>-1) {

    While I can verify this change will remove the error, I have not tested it in relation to your code. So I would recommend double checking your counter is being reset when you expect it to.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘ajaxComplete issue’ is closed to new replies.