Magento 2正确的方式做ajax调用?

This is my controller:

namespace Mvp\Mercury\Controller\Index;

class Display extends \Magento\Framework\App\Action\Action
{

protected $resultJsonFactory;

public function __construct(
    Context                                             $context,
    \Magento\Framework\Controller\Result\JsonFactory    $resultJsonFactory
) {

    $this->resultJsonFactory            = $resultJsonFactory;
    parent::__construct($context);
}


public function execute()
{
    $result                 = $this->resultJsonFactory->create();
    if ($this->getRequest()->isAjax())) 
    {
        $test=Array
        (
            'Firstname' => 'What is your firstname',
            'Email' => 'What is your emailId',
            'Lastname' => 'What is your lastname',
            'Country' => 'Your Country'
        );
        return $result->setData($test);
    }
}

}

I´m making a ajax call to this controller however gives me error , i´m trying it this way:

function addItemToShoppingCart(data)
{
console.log("You are about to add part: " + data.productNumber + " with qty: " + data.quantity + " and price: " + data.price);

var sku        = data.productNumber,
   qty        = data.quantity,
   price      = data.price,
   base_url   = '<?php echo $this->getUrl(); ?>',
   module_url = 'helloworld/index/display',
   full_url   = base_url + module_url;

var cart_info = {
    sku : sku,
    qty : qty,
    price: price
};

console.log(full_url);
console.log(cart_info);

$.ajax({
    showLoader: true,
    url: full_url,
    data: cart_info,
    type: "POST",
    dataType: 'json'
}).done(function (data) {

    console.log('success');

});
} 

based on that i don´t know why it gives me error, the exact code it gives is 500, i checked permissions and they have everything, so what could be the problem here?

500 error doesn't occur due to permission. If the problem was with permission then it would have shown 403 error. 500 error comes when the code has some error. Try to check error log or set deploy mode: developer by running following command:

php bin/magento deploy:mode:set developer

Now, you will be able to see exact error. Now you can solve it or if you face problem, paste the error here.