We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DataManager and CORS request

I am making a request to a cross-domain server for data to populate a Syncfusion Grid. The error I am getting is along the lines of:xmlhttprequest cannot load no 'access-control-allow-origin'.... The response had HTTP status code 405. This error is caused by a request that crosses two different domains. I Google the problem and see that the ej.DataManager request needs to employ Cross Origin Resource Sharing (CORS) to avoid the error. The request is below. Am I using the wrong adaptor?

var dataManager = ej.DataManager({
url: urlStr,
adaptor: new ej.WebApiAdaptor()
});

$("#GridMaster").ejGrid({
dataSource: dataManager,
allowSelection: true,
selectionType: "multiple",
allowPaging: true,
enablePaging: true,
pageSettings: { pageSize: 20 }
});

1 Reply

JK Jayaprakash Kamaraj Syncfusion Team November 8, 2016 12:25 PM UTC

Hi Stephen, 
 
Thank you for contacting Syncfusion support. 
 
To overcome this problem, we suggest you to set crossDomain as true in ejDataManager. The crossDomain is used to retrieve data from another domain. Please refer to the below help document and code example. 
 
 
 
     var dataManger = ej.DataManager({ 
            url: urlStr, 
            crossDomain: true, 
            adaptor: new ej.WebApiAdaptor() 
        }); 
 
Regards, 
 
Jayaprakash K. 


Loader.
Up arrow icon