Seth Duncan
Seth Duncan

Reputation:

Grab Contents of jQuery POST call on C# Page

New to the jquery ajax methods and I am just wondering how to capture the elements passed in the jquery.ajax() call using POST on a C# (ASP.Net) page.

Here is my jquery ajax call:

$.ajax({
            type: "POST",
            url: 'UpdateQuickLinks.aspx',
            data: {"userid": contactid, "update": addString, "remove": removeString},
            success: function(){
                        alert('Worked');
                    },
            error: function(){
                    alert('Nope');
                    }
            });

What do i put in the C# Codebehind on the UpdateQuickLinks.aspx page to capture

userid, update, and remove strings?

Upvotes: 1

Views: 1919

Answers (1)

dahlbyk
dahlbyk

Reputation: 77520

Your page's Request property has a Form collection of values submitted via POST:

var form = this.Request.Form;
var userid = form["userid"];
var update = form["update"];
var remove = form["remove"];

Upvotes: 2

Related Questions