Enable Cross Origin Resource Sharing using Micro

I'm trying to access an api using ajax from an iframe. my ajax call looks like this

var formSubmit = $.ajax({ url: url, type: 'POST', data: pm, beforeSend: function () { $('input:submit').attr("disabled", true); } })

how do I set 'Access-Control-Allow-Origin' header to fix the "No 'Access-Control-Allow-Origin' header is present on the requested resource" error. I'm using Micro in phalcon, not Application

Thanks

In apache/nginx configuration



5.8k
edited Feb '16

you can use $app->after to create cors response header before send it to client