How to call .NET web service from ajax?

41 Views Asked by At

How to call .NET web service from ajax call? I am facing same origin policy error. How can I resolve that?

1

There are 1 best solutions below

0
A.Massard On

Your web service should allow you to request on It.

For example in php

 <?php
 header("Access-Control-Allow-Origin: *");

Where "*" could be replaced by your server location

In dot net, it could be something like (I don't know .NET)

[EnableCors(origins: "http://mywebclient.azurewebsites.net", headers: "*", methods: "*")]