[TYPO3-german] AJAX im Plugin mit eID - Zugriff auf Session

Dr. Dieter Porth web37p2 at web59550.greatnet-hosting.de
Sat Jun 17 07:52:48 CEST 2017


Hallo David

bitte keine Bilder im Forum bzw. in derMailingliste.

Dein TypoScript manipuliert nur den Header  des Response, nicht aber die 
Generierung.

Dein Controller ist nicht auf Json umgestellt.

|class TagController extends ActionController { /** * @var 
\TYPO3\CMS\Extbase\Mvc\View\JsonView */ protected $view; /** * @var 
string */ protected $defaultViewObjectName = 
\TYPO3\CMS\Extbase\Mvc\View\JsonView::class; // Rest of the code stays 
the same }|

Zitiert aus  https://usetypo3.com/json-view.html Code unter der 
Überschrift "the JSON view"

Mit besten Grüßen

     Dieter


Am 16.06.2017 um 19:20 schrieb David Brünner:

> Das ist der Inhalt meiner Webseite: [img]index.php/fa/17139/0/[/img]
>
> So sieht meine setup.ts aus:
> *******************************************************
> page {
>  includeJSFooterlibs {
>    jquery = EXT:kksession2/Resources/Public/Js/jquery-3.2.1.min.js
>  }
>
>  includeJSFooter {
>    session = EXT:kksession2/Resources/Public/Js/test.js
>  }
> }
>
> ajax = PAGE
> ajax {
>  typeNum = 99
>  config {
>    disableAllHeaderCode = 1
>    additionalHeaders = Content-type:application/json
>    admPanel = 0
>    debug = 0
>  }
>  10 < tt_content.list.20.kksession2_kksession2
> }
> *******************************************************
>
> Meine JS (jetzt erstmal aufs Minimum reduziert):
> *******************************************************
> $().ready(function() {
>  $.ajax({
>    dataType: "json",
>    url: ajaxUrl
>  });
> });
> *******************************************************
>
> Nach dem Aufruf der Seite wird ein Ajax-Request ausgelöst. 
> IndexController:
> *******************************************************
> <?php
> namespace KKSoftware\Kksession2\Controller;
>
> use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
> use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
>
> class IndexController extends ActionController {
>
>  public function indexAction() {
>  }
>
>  public function sessionAction() {
>    return json_encode(['test' => 'wert']);
>  }
>
> }
> *******************************************************
>
> Aber statt der erwarteten Antwort (dem JSON) steht im Response des Ajax:
> [img]index.php/fa/17140/0/[/img]
>
> begin 644 vorher.png
> MB5!.1PT*&@H````-24A$4@```0X```!`"`(```!D]@Y:`````W-"250("`C;
> MX4_@````&71%6'13;V9T=V%R90!G;F]M92US8W)E96YS:&]T[P._/@``![9)
> M1$%4>)SMW'],%&<:!_"G>+?#/SLDO>XD'+O)JFMN#C:AMYP0\4(+/>[`HMTT
> ....
> M0YJ(B(B(B(@H"0QI(B(B(B(BHB0PI(F(B(B(B(B2\!]FJ"2`J-9G+`````!)
> '14Y$KD)@@@``
> `
> end
>
> _______________________________________________
> TYPO3-german mailing list
> TYPO3-german at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german

-- 
----
Dr. Dieter Porth - Web-Entwickler



More information about the TYPO3-german mailing list