I've created a database locally, and used Microsoft's WCF Data Services to create an OData service. I've managed to figure out how to read the data, but when attempting to update, Google Chrome gives this error:
"Origin null is not allowed by Access-Control-Allow-Origin."
This only happens when I open my HTML page directly from my C drive (without a web server). If I go via my web server, then it works. Any ideas as to how I can get this to work without using a web server?
Here's my code:
var results=BOData.StephenBO1;
results[0].txtLastStage = $("#txtLastStage").val();
results[0].txtTeamCode = $("#txtTeamCode").val();
results[0].txtClientName = $("#txtClientName").val();
var url = "http://localhost/odata/StephenService.svc/CL_Darwin1('0900000000000000000000000000276')";
var json = JSON.stringify(results[0]);
$.ajax({
url: url,
data: json,
type: "PUT",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
alert("Saved StephenBO1");
},
error: function (result) {
alert("Update Failure - Status Code=" +
result.status + ", Status=" + result.statusText);
}
});
Any wise and intelligent comments would be appreciated... and let me know if you need any additional info.
Thanks, Stephen