Yii2 show partial view inside a modal with fetch() Vanilla JS

i’ve a problem using fetch() API for showing a partial view inside a modal.

My controller is this:

public function actionIndexAjax()
    {
        if (Yii::$app->request->isAjax) {
            return $this->renderAjax('selectImage');  
        }
    }

And in my principal view a i have a button that triggers the modal, so i creata a javascript code
to get this view with fetch() like this:

fetch(url, {
            method: 'GET',
            headers: {
                'X-Requested-With': 'XMLHttpRequest',
            }
        }).then(function (response) {
            if (response.ok) {
                return response.json();
        }else{
                return Promise.reject(response);
            }            
        }).then(function (data) {
            console.log(data);

        }).catch(function (error) {
            console.warn('Something went wrong.', error);
        });

But i get this error:

SyntaxError: JSON.parse: unexpected character at line 2 column 1 of
the JSON data

I don’t know where the problem is

N.B. Instead if i use the jquery function works fine.