Click here to Skip to main content
16,020,182 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
JavaScript
$.ajax({
            type: "GET",
            url: "http://shoperola.com/Restaurant/foodysrest/sample",
            crossDomain: true,
            cache: false,
            dataType: "json",
            Complete: function(xhr) {xhr.getResponseHeader("Accept", "json")}, 
            success: function (data, textStatus, xhr) {
                console.log(data);
                console.log(xhr.getResponseHeader("Content-Length"));
            },
            error: function (xhr, textStatus, errorThrown) {
                console.log(errorThrown+"---"+textStatus);
            }
        });


this code returns HTTP status "200" but fires error. please any one suggest me how to perform a webservice.

this is the error : "XMLHttpRequest cannot load http://shoperola.com/Restaurant/foodysrest/sample?_=1389172009980. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://<localhost>:3294' is therefore not allowed access."
Posted
Updated 8-Jan-14 0:22am
v6
Comments
Kornfeld Eliyahu Peter 8-Jan-14 3:59am    
What error?
Sandeep Akkireddy 8-Jan-14 4:01am    
this error block executes instead of success. error: function (xhr, textStatus, errorThrown) {
console.log(errorThrown+"---"+textStatus);
}
Kornfeld Eliyahu Peter 8-Jan-14 4:03am    
I see but the error? It may surprise you but I can't see your monitor while you debug...
Sandeep Akkireddy 8-Jan-14 4:07am    
XMLHttpRequest cannot load http://shoperola.com/Restaurant/foodysrest/sample?_=1389172009980. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3294' is therefore not allowed access.
Sandeep Akkireddy 8-Jan-14 4:08am    
this is the error

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900