JSFiddle - React, Tailwind, and code Playground

JavaScript

class RegularPacket {
	constructor() {
		this.__ajax();
	}
  func() {
  	console.log('работает блять');
  }
	__ajax() {
		jQuery.ajax( {
			type: 'POST',
			url: 'php/ajax.php',
			data: { action: 'pause', timeout: 100 },
			dataType: 'json',
			success: this.__ajaxSuccess,
			error: this.__ajaxError
		} );
	}
	__ajaxSuccess(data, textStatus, XMLHttpRequest) {
		console.log(this); // объект аякса
		if(data.status === 'ok') {
			this.func(); // говорит, что я пидор, ибо в объекте аякса конечно же нет метода func
		} else if(data.status === 'error') {
			console.error(data.message);
		}
	}
	__ajaxError(XMLHttpRequest, textStatus, errorThrown) {
		console.error('ajax');
	}
}