我們有網址,當我們在瀏覽器中輸入網址URL時,我們得到了數據。我們得到的數據像ajax GET不工作(服務數據沒有得到)
[{"UserId":"c2fbd9fb-a423-4d33-9ea4-3aa58f7b52cf","UserType":"Parent","OutPutMessage":"Sucess"}].
,但我們需要通過Ajax call.we獲取數據試過這樣
window.onload = function(){
$.ajax({
url:'http://janasenanews.com/MyService.asmx/GetUserLoginVerification',
data: {
username:"9440325333",
password :"9440325333"
},
type: "GET",
dataType: 'JSON',
success:function(data) {
alert(data);
//console.log("Here is the data", data);
}
});
}
,但我們得到了兩個錯誤
Failed to load resource: the server responded with a status of 500 (Internal Server
XMLHttpRequest cannot load Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 500.
請引導我們什麼錯我們的代碼。
[途徑可能的複製以規避同源政策](http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy) –
如果您將錯誤消息的文本複製到這個問題。 –