I have a ASP.NET webforms project in .NET 3.5 running locally on my machine hosting an ASMX web service. The web service works fine when called from Ajax in IE8, however, using Firefox and Chrome do not work.
The jQuery code is:
$.post("http://localhost:64284/StockService.asmx/DeleteStock",
{ stockId: '"' + code + '"' });
Code is a previous value retrieved from a form element.
This service works fine when invoked from Internet Explorer. It does not work from Chrome or Firefox. I have also tried the $.ajax which doesn’t work either.
Firebug shows “OPTIONS DeleteStock” in the Net panel which I find odd as that is the name of the service method. I’d of expected to see POST StockService.asmx however I’m new to jQuery Ajax.
The consuming application is a web forms project, also running on my machine but on another port, but running .NET 4.
Can anyone give any advice? The service is defined as:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class StockService: System.Web.Services.WebService
// ...
[WebMethod]
public JimStock[] DeleteStock(string stockId)
{
// ...
}
As point out by ThiefMaster and stockmanagement point out – the issue was that it was cross domain. Unfortunately, they didn’t leave an answer so I had to.