Click here to Skip to main content
15,896,453 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
hi, I wanna know how can I receive the parameter that I send via ajax in the c# classe to insert in the database, here´s the javascript code:

C#
$.ajax({
      type: 'POST',
      url: 'new_circle.aspx/insertCirclePeople',

      data: "code=" + $('#txtcode').val(),
      //dataType:'json',
      statusCode: {
          404: function () {
              alert('Page not found');
          },
          500: function () {
              alert('Server error');
          }
      },
      success: function (data) {

      }
  });
Posted
Comments
Member 9581488 13-Dec-12 16:15pm    
Create Json object in insertCirclePeople method. Return json on success and you can grab that Json obj in your success function in AJAX.
vanilsonwdd 13-Dec-12 16:31pm    
What about the code in the c# class? How I´m gonna receive the value that I send to the send using json? I´m new in asp.net, the json in the javascript isn´t the problem, my problem is in the c# class
Member 9581488 13-Dec-12 16:37pm    
Use json Desearialize to Get obj value.
Please refer following link

http://www.codeproject.com/Tips/397574/Use-Csharp-to-get-JSON-data-from-the-web-and-map-i
Sergey Alexandrovich Kryukov 13-Dec-12 16:38pm    
How is this related to C# class? :-)
--SA

1 solution

In MVC you can just make the parameters parameters in your method that you call. In straight ASP.NET, I'd put them on the URL you call and get them from there
 
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