Extbase Ajax Example Extension

GIT: https://github.com/wallpageNET/infochy_ajaxexample
TER: https://typo3.org/extensions/repository/view/infochy_ajaxexample

Typoscript

page.includeJSFooter {
  infochy_ajaxexample = EXT:infochy_ajaxexample/Resources/Public/Javascript/ajax.js
}
ajaxCall = PAGE
ajaxCall {
   typeNum = 22222
   config {
    disableAllHeaderCode = 1
    xhtml_cleaning = 0
    admPanel = 0
    additionalHeaders = Content-type: text/plain
    no_cache = 1
    debug = 0
   }
   10 = USER
   10 {
	    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
	    extensionName = InfochyAjaxexample
	    pluginName = Plugin
	    vendorName = Infochy
	    controller = Ajaxexample
	    action = ajax
	    view < plugin.tx_infochyajaxexample_plugin.view
	    persistence < plugin.tx_infochyajaxexample_plugin.persistence
	    settings < plugin.tx_infochyajaxexample_plugin.settings
   }
}

JavaScript

$("form.newAjaxexample").submit(function (event) {
    event.preventDefault();
    var form = $(this);
    var action = form.attr("action"),
          method = form.attr("method"),
          data = form.serialize();

    $.ajax({
        url: action,
        type: method,
        data: data
        }).done(function (data) {
            $( "div.tx-infochy-ajaxexample" ).replaceWith( data );
        }).fail(function () {
			( "div.tx-infochy-ajaxexample" ).replaceWith("errorMessage");  
        }).always(function () {
        
        });
});

HTML

<f:form action="ajax" 
    controller="Ajaxexample" 
    extensionName="InfochyAjaxexample" 
    pluginName="Plugin"
    name="newAjaxexample"
    method="POST"  
    pageType="22222"
    class="newAjaxexample"  object="{newAjaxexample}">    
<f:render partial="Ajaxexample/FormFields" />
	<f:form.submit value="Ajax new" />
</f:form>

TypoScript Ajax

ajaxCall = PAGE
ajaxCall {
typeNum = 999
config {
disableAllHeaderCode = 1
xhtml_cleaning = 0
admPanel = 0
additionalHeaders = Content-type: text/plain
no_cache = 1
debug = 0
}
10 < lib.stdContent }