Skip to main content
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

Please suggest or any workarounds how this can be resolved

6 answers
0/9000