javascript - Issues with CORS, Jquery and Coldfusion. Headers -
i using following code handle jquery stuff:
var data = $('#loginform').serialize(); alert(data); $.ajax({ url: 'https://devport.mywebsite.com/login.cfm?method=login', crossdomain: true, type: "post", data: data, cache: false, beforesend: function (xhr) { xhr.setrequestheader("access-control-allow-origin", "*"); }, success: function (data) { alert(data); }, error: function (xhr, teststatus, error) { alert(teststatus + " " + error); } });
it time going error, not sure why problem is. error is:
sec7123: request header access-control-allow-origin not present in access-control-allow-headers list. script7002: xmlhttprequest: network error 0x80070005, access denied.
the coldfusion side this:
<cfcontent type='text/html; charset=utf-8'> <cfheader name="access-control-allow-origin" value="*"> <cfheader name="access-control-allow-headers" value="content-type" />
now login function @ bottom this:
<cfif login true>success <cfabort> <cfelse>fail<cfabort> </cfif>
i have enabled core n jquery with:
$.support.cors = true;
something wrong not sure what.
Comments
Post a Comment