0

I have a view in different controller. I am using ajax call from jquery to post to a different controller's method. I get the following error.

Failed to load https://nete-pelmer.com/roadrace/support/sendMessage: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://nete-pelmer.com' is therefore not allowed access.

When i post to same controller action which this view belongs to then this error no longer happens. I appreciate any help!

Rory McCrossan
  • 319,460
  • 37
  • 290
  • 318
kofhearts
  • 3,157
  • 7
  • 37
  • 73
  • URL schemes of both sender and recipient need to be identical. In this case you're sending from `http://` to `https://`. Make them use the same protocol and the error will disappear. The error itself is indicative of is a cross-origin call, which you can read about in the duplicate I marked. – Rory McCrossan May 01 '18 at 06:55
  • thanks i am using relative path $.ajax('/roadrace/support/sendMessage' – kofhearts May 01 '18 at 06:57
  • thanks. that maybe the issue. the view is in http and it is making request to https. – kofhearts May 01 '18 at 07:00

0 Answers0