Click here to Skip to main content
11,482,402 members (75,029 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Javascript Ajax jQuery
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:

      $.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 13-Dec-12 11:03am
Comments
Member 9581488 at 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 at 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 at 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 at 13-Dec-12 16:38pm
   
How is this related to C# class? :-)
--SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  

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



Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 13 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100