0
$(document).ready(function () {
$.ajax({
    type: "POST",
    url: "/ajax/customcss",
    data: {channel: currentChannel},
    })
    .done(function( data ) {

        var jsonObj= JSON.parse(data);

        console.log(jsonObj);


});
});

I get this error:

POST http://mywebsite.com/ajax/customcss 403 (Forbidden)

Which is a cross scripting error. Any ideas?

1 Answer 1

0

That is not a cross scripting error necessarily, but probably is in your case. I can think of a bunch of ways to send out 403's from my server. Anyways, what script does that post to? Is that an EE template group ("ajax") and template ("customcss")?

Not sure why you are going about it that way, but POSTing to templates should always bounce without a CSRF token. Add one!

....
data: {channel: currentChannel, csrf_token: "{csrf_token}"},
....

https://ellislab.com/expressionengine/user-guide/development/guidelines/security.html#id13

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.