• Resolved dbleier

    (@dbleier)


    How can I make an ajax call from an admin page to the admin controller?

    So far the only way I saw to do ajax from an admin view was to create a separate public controller and hit that. The problem with that is exposure to the world and an additional controller. I do check the current logged in user for security, but would prefer not using something that is exposed for admin functionality.

    thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Robert Peake

    (@robertpeake)

    wp-mvc does not currently have an default functionality to support admin ajax as part of the framework.

    So, for now, you would have to call a public endpoint with a blank layout to pass e.g. json back. To add to security, in addition to checking for a logged-in user, you can use the WordPress admin nonce functionality.

    In future, it would be nice to be able to call ajax against an admin endpoint and be able to have it send back arbitrary data without being wrapped in the admin layout. If you do develop this, we would welcome a pull request. ??

    • This reply was modified 7 years, 10 months ago by Robert Peake.
    Thread Starter dbleier

    (@dbleier)

    ok, thanks for the reply. If I develop anything I’ll let you know. ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘secured ajax calls from admin page’ is closed to new replies.