Menu Close
    Hire us Request quote Reading list Switch to dark mode

    Return JSON Data with AJAX call in Magento 2

    Today, we will see how to return json data from controller while doing an ajax call.
    Situation may come that you are doing some customization and need to deal will json data from controller then here is the way how we can go for it.

    For that we can use the magento core class,

    which has list of constant mapped to corresponding classes :

    among these, we can use the constant to return json data :

    Now here is the complete code to implement above.

    This is all we need , hope this help you out. happy coding.

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close