To pass Ajax response from the controller in Magento 2, You need to use Magento\Framework\Controller\Result\JsonFactory Object.
Many times your custom functionality requires you to use Ajax request on a page to display information without any page load and in this situation, you need to know about Ajax use in Magento 2 to achieve your requirement.
Magento\Framework\Controller\Result\JsonFactory is used for sending a response from a controller to an Ajax request.
Pass your response in the setData() method.

http://www.mage2check.com is the best Tool to check either your ecommerce store or website has been created by using Magento 2 or Not.
Please follow YouTube Video for further details as https://www.youtube.com/watch?v=eSUfUC6aI14
Please hit URL [ http://www.mage2check.com ] & put your ecommerce store or website URL & click on Go Button & Display Result as any of them as below.
[1] Magento 2 Community Edition With Version.
[2] Magento 2 Enterprise Edition With Version.
[3] Magento 2 Enterprise Cloud Edition With Version.
http://www.codextblog.com/magento-2/make-ajax-call-magento-2-module/