TheFlame
TheFlame

Reputation: 57

TYPO3 Backend: AJAX with jQuery (params empty)

According to the Backend API: https://docs.typo3.org/typo3cms/CoreApiReference/JavaScript/Ajax/Backend/Index.html I could use every library to do AJAX calls in the TYPO3 Backend.

I get the success message, but my params array is always empty:

Controller

public function renderShowModal($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL){
    var_dump($params);
}

jQuery

            $.ajax({
            type: 'POST',
            url: TYPO3.settings.ajaxUrls['Controller::renderShowModal'],
            data: {
                "test": "bar"
            },
            success: function (result) {
                console.log(result);
            },
            error: function (error) {
                console.log(error);
            }
        });

What am I missing or how do I have to send my data?

It's even not working like this:

{"tx_ext_bm[test]": "bar"}

Thanks in advance

Upvotes: 0

Views: 668

Answers (1)

TheFlame
TheFlame

Reputation: 57

There is no answer in any of the forums I've questioned this, so I ended up accessing the params the traditional way with $_POST.

Upvotes: 0

Related Questions