You need to sign in to do that
Don't have an account?
Access-Control-Allow-Origin error CORS Issue
I am facing cross domain error on ajax request in javascript
Ajax Request
$.ajax({
url:"../oppitm/lineitemsort.jsp?id={!oppID}",
contentType:"text/html",
xhrFields:{withCredentials:true}
}).done (
function(data){console.log(data)});
Error
XMLHttpRequest cannot load https://ap1.salesforce.com/oppitm/lineitemsort.jsp?id=00690000007jIM1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://nsp-demo.ap1.visual.force.com' is therefore not allowed access.
I have enabled below origin urls in CORS
Ajax Request
$.ajax({
url:"../oppitm/lineitemsort.jsp?id={!oppID}",
contentType:"text/html",
xhrFields:{withCredentials:true}
}).done (
function(data){console.log(data)});
Error
XMLHttpRequest cannot load https://ap1.salesforce.com/oppitm/lineitemsort.jsp?id=00690000007jIM1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://nsp-demo.ap1.visual.force.com' is therefore not allowed access.
I have enabled below origin urls in CORS
- https://*.salesforce.com
- https://ap1.salesforce.com
- https://nsp-demo.ap1.visual.force.com
Please refer the below link for reference.
- http://salesforce.stackexchange.com/questions/51193/xmlhttprequest-cannot-load-no-access-control-allow-origin-is-present
- https://success.salesforce.com/answers?id=90630000000i2jOAAQ
- https://help.salesforce.com/articleView?id=XMLHttpRequest-cannot-load-No-Access-Control-Allow-Origin-is-present&language=en_US&type=1
I hope it will be helpful.Please mark it as Best Answer If it resolved the issue.
BestRegards
RahulKumar
- https://tgh.llc
- https://www.tgh.llc
Depending on where your code is hosted could determine which static URL(s) to use.