Click here to Skip to main content
15,879,844 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all,

i had make wcf services, what when i try invoke insert method using jquery, it's not work:

here is my code :
WCF code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Data; 

// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService" in both code and config file together.
[ServiceContract]
public interface IService
{
    [OperationContract]
    void addnewcategory(string name, int price, int type);
    [OperationContract]
    DataTable selectcategory();
    [OperationContract]
    void updatecategory(string Name, int price, int type, int id);
    [OperationContract]
    Boolean deletecategory(int id);
	
}


service.cs code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Bal;
using System.Data;

// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service" in code, svc and config file together.
public class Service : IService
{
    public void addnewcategory(string name, int price, int type)
    {
        Bal.insertcategory obbalinsertcategory = new Bal.insertcategory();
        obbalinsertcategory.inserttocategory(name, price, type);

    }
    public DataTable selectcategory()
    {
        Bal.insertcategory obbalinsertcategory = new Bal.insertcategory();
        return obbalinsertcategory.selectcategory();

    }
    public void updatecategory(string Name, int price, int type, int id)
    {
        Bal.insertcategory obbalinsertcategory = new Bal.insertcategory();
        obbalinsertcategory.updatecategroy(Name, price, type, id);
    }
    public Boolean deletecategory(int id)
    {
        Bal.insertcategory obdelte = new Bal.insertcategory();
        return obdelte.deletecategory(id);

    }
}


web.config
<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
	<connectionStrings>
		<add name="Con" connectionString="Data Source=.;Initial Catalog=market;User ID=sa;Password=market;Trusted_Connection=false;Pooling=false"/>
	</connectionStrings>
	<system.web>
		<compilation debug="true" targetFramework="4.0"/>
	</system.web>
	<system.serviceModel>
		<behaviors>
			<serviceBehaviors>
				<behavior name="">
					<serviceMetadata httpGetEnabled="true"/>
					<serviceDebug includeExceptionDetailInFaults="false"/>
				</behavior>
			</serviceBehaviors>
		</behaviors>
		<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
	</system.serviceModel>
</configuration>



aspx code:
hi need here jquery method that invoke addnewcategory from webserice please help
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900