Alfresco社區版 - 5.1.x。調用外部web服務時,我收到提示無法獲取引起Alfresco:外部Web服務調用gettting錯誤無法獲得結果?
代碼:
function updateList(){
Alfresco.util.Ajax.request({
url: "http://test.com/webservice/mgmobile/mgserver.php?wsfunction=course_get_all_courses&wstoken=7f5e0f05f7c54ece7a23f02fe3718464",
method: Alfresco.util.Ajax.GET,
headers: ('Access-Control-Allow-Origin: *'),
headers: ('Access-Control-Request-Headers: *'),
headers: ('Access-Control-Allow-Methods: *'),
requestContentType: Alfresco.util.Ajax.JSON,
successCallback:{
fn: function(res){
appendOptiOnvalues(res)
},
},
failureCallback:{
fn: function(res){
alert("Error");
},
}
});
}
錯誤:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://test.com/webservice/mgmobile/mgserver.php?wsfunction=course_get_all_courses&wstoken=7f5e0f05f7c54ece7a23f02fe3718464 . (Reason: missing token 'content-type' in CORS header 'Access-Control-Allow-Headers' from CORS preflight channel).
這個請大家幫忙。
http://www.slideshare.net/jottley/cors-enable-alfresco-for-cors。你能快點看看嗎? –