0

I'm retrieving an a list of sites, groups, and users. I'm concatenating and placing them in their respective variable, sending them in a query string to an aspx file.

var url = (Page._BASE_URL + 'Mo/Un/Unis/Unifie.aspx?' + getUserSecurityParameter() +
    '&action=sending&userIds=' + encodeURI(userIds) +
    '&siteName=' + encodeURI(site) +
    '&groupName=' + encodeURI(groupName) +
    '&siteList=' + encodeURI(siteList) +
    '&team=' + encodeURI(team) +
    '&users=' + encodeURI(users)+
    '&site=' + encodeURI(site));

Ii'm using this code to retrieve those values on from the ajax post. I notice when I notice check the aspx source, There's so much data between the groups and sites that the users variable and data is never present.

var siteName = $.getUrlVar('siteName');
var groupName = $.getUrlVar('groupName');
var users= $.getUrlVar('users');

Is there a better way to do this so I won't have this issue? Because of missing users data it throws of a query that is written on the back end. Thanks in advance.

This is what I have now. When I try to send the data over I get an error. I can't see the what the error is unfortunately.

    var requestParameters =
    {
        siteList: siteList,
        team: team,
        users: users,
        siteName: site,
        site: site,
        group: group,
        userId: userId,
        securityCode: getUserSecurityParameter()
    };

$.ajax({
    url: Im._B + 'Mo/Uni/Unif/Ui.aspx/getValues',
    type: "POST",
    data: JSON.stringify(requestParameters),
    contentType: "application/json; charset=UTF-8",
    done: function (requestParameters, textStatus, jqXHR) {
        var left = Math.floor((screen.width - 545) / 2);

        windowManager.openFixed(url, 'DocumentListWindow', left, /* top: */ 10, /* width: */ 1480, /* height: */ 840);
},
    error: function (jqXHR, textStatus, errorThrown) {
    alert('An error occurred trying to send the data.');
}
});

Ui.aspx.cs

[System.Web.Services.WebMethod]
public static string getValues(string requestParameters)
{

    string mystuff = requestParameters;
    return mystuff;
}

ERROR "{\"Message\":\"Operation is not valid due to the current state of the object.\",\"StackTrace\":\"

jan86
  • 107
  • 2
  • 15

1 Answers1

0

Although there is technically no limit to the length of a query string, individual browsers do have limits. Follow Alex's advice and convert this to a post.