I've recently battled this in CFML too. In my CF application I added: <cfheader name="content-type" value="application/json"> <cfheader name="Access-Control-Allow-Origin" value=" http://domain-making-request-goes-here:8889"><!--- *** ---> <cfheader name="Access-Control-Allow-Credentials" value="true"><!--- *** ---> <cfoutput>#serializeJSON(session)#</cfoutput>
The in the client application: <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js "></script> <script> $(function() { $("button").click(function() { $.ajax({ url: "http://the-domain-for-the-cf-app:8889/a-page.cfm", xhrFields: { withCredentials: true // *** } }).done(function(res) { console.log(res.count); }); }); }); </script> <button>Keep Alive</button> This was all part of a quick test to see if we could keep a session alive as we moved between two applications we're building. I've marked the important parts with *** in the code above. As someone has already mentioned, read up on CORS here: http://enable-cors.org/ and remember that it's a server issue, not a client one. Adrian On 29 October 2014 11:23, Sander Elias <[email protected]> wrote: > Amadese, > > you can’t use Access-Control-Allow-Origin:'*' in a lot of circumstances. > In stead of a star, you must put the name of the domain you are calling in > there. > in your case, that would probably be: 'dev.testmyserver' > > Hope this helps a bit, > Regards > Sander > > > -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
