Creating an ajax request call in magento is quite easy.
All the requests are handled by the controllers in Magento. So Inside the request controllers we need to create a block programmatically which will return a view html output.
Magento uses “block” concept to handle the html output. Blocks are special classes that handles the view section in magento.
Now create the ajax function and send your ajax request to this controller action.
This code will create and render a block in the controller and will return the html output.