0
votes

I have been stuck on this for about a day now. I recently upgraded from 7.6 to 8.7, and my Ajax feature no longer works. The problem: the page that I generate to host my plugin for the Ajax call is empty (always).

Here is the code that I use to generate the page:

ajaxselectlist_page = PAGE
ajaxselectlist_page {
    typeNum = 427590

    config {
        disableAllHeaderCode = 1
        additionalHeaders = Content-type:application/html
        xhtml_cleaning = 0
        debug = 0
        no_cache = 1
        admPanel = 0
    }

    10 < tt_content.list.20.extension_controller
}

I have tested it, and the problem seems to be with the plugin generation, as I have no problem generating generic text on the page.

I did manage to get it working very briefly using the following code instead, though even this returned empty as soon as I made my first Ajax call.

10 = USER
10 {
    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->getInstance
    vendorName = HarryLaForge
    extensionName = Inventory
    pluginName = Item
    controller = Item
}

One other point of information: when I updated to 8.7 I also removed the boostrap_package from my installation in lieu of simply creating my own templates. I don't think that this should have caused the problem, but I thought I would mention it none-the-less.

Thanks a million!

3
What do you mean, briefly?j4k3
Did I understand correctly, that a regular request in the browser to http://your-host/?type=427590 works, but does not if executed as XHR (AJAX)?Oliver Hader

3 Answers

1
votes

As of TYPO3 8.x additionalHeaders is an array:

additionalHeaders {
    10 {
        header = Content-Type: application/html
        replace = 1
    }
}
0
votes

If you can output some TEXT on your typeNum page but your plugin returns nothing, then maybe your plugin is not compatible with TYPO3 8? Turn on display_errors in your Installtool (set Environment to Development) and check the page for errors again (or your PHP errorlog)

0
votes

First set 'displayErrors' => 1 in LocalConfiguration.php file. So, You can find exact problems on this page.

Also USER function systax is changed for TYPO3 8 something like below.

page = PAGE
page.10 = USER
page.10 {
  userFunc = Your\NameSpace\YourClass->yourMethods
  vendorName = HarryLaForge
  extensionName = Inventory
} 

And your class file like this.

namespace Your\NameSpace;

class YourClass {
  /**
   * Output the current time in red letters
   *
   * @param  string          Empty string (no content to process)
   * @param  array           TypoScript configuration
   * @return string          HTML output, showing the current server time.
   */
  public function yourMethods($content, $conf) {
     .....
     ......
  }
}