Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2005
    Thanked 0 Times in 0 Posts

    Unhappy Parsing a Querystring in ASP using serverside javascript. Please Help!

    Hey guys I am new and in need of help. I have an ASP application written in serverside javascript that uses WinHTTP 5.1 to post to a page and then recieve a response (a query string that looks like the following):


    This info is used to create variables and perform further tasks. I have a function that is supposed to handle parsing the string then placing the returned info into variables. The code I am trying to use is below. The problem is that the returned variables that I am creating contain no data!!! Now it is based on some client side code, but it should still work on the server with the changes I have made, can anybody help or make suggestions.



    // Read the values from the Response and create a variable
    preobjHttpResponse = preobjHttp.responseText;

    // function to parse the string begins
    function gettheQueryString() {
    var theargs = new Object();
    // Get Query String
    var thequery = preobjHttpResponse;
    // Split thequery at the comma
    var thepairs = thequery.split("&");

    var thecounter = 0;

    // Begin loop through the querystring
    for(var i = 0; i < thepairs.length; i++) {

    // Look for "name=value"
    var thepos = thepairs[i].indexOf('=');

    // if not found, skip to next
    if (thepos == -1) continue;

    // Extract the name
    var theargname = thepairs[i].substring(0,thepos);

    // Extract the value
    var value = thepairs[i].substring(thepos+1);

    // Store as a property
    if (!theargs[theargname]) {
    theargs[theargname] = unescape(value);
    else {
    theargs[theargname] += ("&" + theargname + "=" + unescape(value));

    return theargs; // Return the Object

    var oQS = gettheQueryString();

    // Now, we can access the items:
    theRequestResponse = oQS.item1;
    theApprovalResponse = oQS.item2;
    theavsAddressResponse = oQS.item3;
    theavsZipResponse = oQS.item4;
    thecvvResponse = oQS.item5;
    theProcessVerbiage = oQS.item6;

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Thanked 256 Times in 252 Posts

    Double-posting is against forum rules!

    You should have not started another thread and just PM the mod to move the original thread here.

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts