Language: JavaScript
Label: vulnerable
CWE: CWE-79 \u2014 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.

Code:
        ,data: $(this).closest('tr').find('input[data-form="' + mode + '"],select[data-form="' + mode + '"]').serializeArray()
        ,beforeSend: function() {
          if (mode == 'add' || mode == 'delete') {
            $(target).html(
              '<div class="span2 alert">Request submitted...</div>'
            );
          }
        }
        ,success: function() {
          if (mode == 'add') {
            toastr.success('Added record');
            $('#' + tab + '_form').trigger('submit');
          }
          else if (mode == 'delete') {
            toastr.success('Deleted record');
            $('#' + tab + '_form').trigger('submit');
          }
          else {
            toastr.success('Updated record');
          }
        }
        // TODO: fix sanity_ok in Netdisco Web
        ,error: function() {
          if (mode == 'add') {
            toastr.error('Failed to add record');
            $('#' + tab + '_form').trigger('submit');
          }
          else if (mode == 'delete') {
            toastr.error('Failed to delete record');
            $('#' + tab + '_form').trigger('submit');
          }
          else {
            toastr.error('Failed to update record');
          }
        }
      });
    });

    // bind qtip2 to show the event log output
    $(target).on('mouseover', '.nd_jobqueueitem', function(event) {
      $(this).qtip({
        overwrite: false,
        content: {
          attr: 'data-content'
        },
        show: {
          event: event.type,
          ready: true,
          delay: 100
        },
        position: {
          my: 'top center',
          at: 'bottom center',
          target: false
        },
        style: {
          classes: 'qtip-cluetip qtip-rounded nd_qtip-unconstrained'
        }
      });
    });
  });