I have a WebAPI and I need AJAX call to access this but on the cross domain
Here is my code :
$.ajax({
type: "POST",
url: '/api/myapiname/apiactionname',
contentType: "application/json",
data: {
name: "Abhishek",
email: "abhi@abhi.com",
password: "******"
},
crossDomain:true,
success: function(data) { console.log(data); },
error: function(data) {console.log(data); },
dataType: 'json',
beforeSend: function (xhr) {
xhr.setRequestHeader("Access-Control-Allow-Origin", "*");
},
});