Call web service from jQuery

I'm trying to use jQuery to consume my Web service and just basically need the web service to call functions that's all.

The code I'm using in .NET is this:

[ServiceContract(Namespace = "http://Sinvise.Service/")]
    public interface ISinvise
    {
        [OperationContract]
        void Output(string value);
    }

    class SinviseService : ISinvise
    {
        second sec = new second();

        public void Output(string value)
        {
            sec.message(value);
        }
    }

+

Uri baseAddr = new Uri("http://localhost:60185/Sinvise");
            ServiceHost localHost = new ServiceHost(typeof(SinviseService), baseAddr);

            try
            {
                Process.Start(baseAddr.AbsoluteUri);
                localHost.AddServiceEndpoint(typeof(ISinvise), new WSHttpBinding(), "CalculatorService");

                ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
                smb.HttpGetEnabled = true;
                localHost.Description.Behaviors.Add(smb);

                localHost.Open();
                Console.WriteLine("Service initialized.");
                Console.WriteLine("Press the ENTER key to terminate service.");
                Console.ReadLine();

                localHost.Close();
            }
            catch (CommunicationException ex)
            {
                Console.WriteLine("Oops! Exception: {0}", ex.Message);
                localHost.Abort();
            }

How would I be able to simply call the Output web service?

Thanks

Answers


You can use an ajax request using .get()

Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, or protocol. Script and JSONP requests are not subject to the same origin policy restrictions.


Need Your Help

Error message when using Specpool in Vegan Package

r vegan

I'm trying to calculate species richness and chao for a list of sites. However I keep getting this error message:

Looking Up Values in Separate Workbook and Copying Data to This Workbook

excel excel-vba excel-2010 vba

I've been working on this one for a couple weeks now and I can't seem to get it right. The concept seems easy which is why I'm so frustrated with it. I finally resorted to posting here for some inp...