I have this function within my <script> tags:

    var data = {
        title: "This is a title"

    Craft.postActionRequest('plugin/controller/action', data, function(response) {

The "Craft" function returns as "TypeError: Craft is undefined". I'm guessing I somehow need to reference the scope to the function but I can't seem to get it to work.

I tried adding _self = this outside my jquery click function and reference Craft like "_self.Craft" but that didn't do it.

What am I missing here?

  • 2
    Is this front-end or back-end? Commented Oct 10, 2014 at 13:07
  • It's for front-end use Commented Oct 10, 2014 at 13:12
  • Oh man I'm so retarded... ofc I can't use it on the front-end. Haha... Mystery solved. Commented Oct 10, 2014 at 13:13

1 Answer 1


The "Craft" javascript global object can only be used in the backend, not on the frontend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.