0

someone kindly posted the following solution to consuming web services from this question at this link:

How to use jQuery to call an ASP.NET web service?

function InfoByDate(sDate, eDate){
var divToBeWorkedOn = '#AjaxPlaceHolder';
var webMethod = 'http://MyWebService/Web.asmx/GetInfoByDates'
var parameters = "{'sDate':'" + sDate + "','eDate':'" + eDate + "'}"

$.ajax({
        type: "POST",
        url: webMethod,
        data: parameters,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {    
                $(divToBeWorkedOn).html(msg.d);
        },
        error: function(e){
                $(divToBeWorkedOn).html("Unavailable");                          
        }
});

}

It all goes well, and the data that I want is returned, BUT, I always get a warning from IE about 'This page is accessing information which is not under its control. This poses a security risk ... etc', and with Opera the information does not load because of a "Security violation" error.

How do I overcome this - I really need to stick with javascript because the code has to be placed in pages where I do not have access to the server programming facilities.

Thanks people.

1 Answer 1

1

You can only access web services from your local domain. You'll have to create a proxy locally that passes on the data returned from that remote web service. That is, if the web service is actually remote. If not, use a relative or absolute path to the ws.

Sign up to request clarification or add additional context in comments.

1 Comment

I appreciate your response ScottE - if you care to expand on what it means to create a proxy then I would be obliged. BB. I'll look it up as well :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.