1

Hi I have a table that was created in javascript, what I need to know is how to pass the values in row 1 or 2 into a aspx page using javascript with the click of a button: here is my javascript code:

newContent += Hesto.Html.StartTR(item.CommonCable, 'lineInfoRow');
            newContent += Hesto.Html.CreateTD('<input type="button" value="Print" id="btnprint" onclick="Redirect()">',null);
            newContent += Hesto.Html.CreateTD(item.CommonCable, null, null);
            newContent += Hesto.Html.CreateTD(item.Wire, null, null);
            newContent += Hesto.Html.CreateTD(item.WireLength * 1000, null, 'centerAlign');
            newContent += Hesto.Html.CreateTD(item.TerminalA, null, (sideFlag == 1 ? 'highlightOneSide' : (sideFlag == 3 ? 'highlightTwoSides' : 'highlightNone')));
            newContent += Hesto.Html.CreateTD(item.SealA, null, (sideFlag == 1 ? 'highlightOneSide' : (sideFlag == 3 ? 'highlightTwoSides' : 'highlightNone')));
            newContent += Hesto.Html.CreateTD(item.TerminalB, null, (sideFlag == 2 ? 'highlightOneSide' : (sideFlag == 3 ? 'highlightTwoSides' : 'highlightNone')));
            newContent += Hesto.Html.CreateTD(item.SealB, null, (sideFlag == 2 ? 'highlightOneSide' : (sideFlag == 3 ? 'highlightTwoSides' : 'highlightNone')));
            newContent = Hesto.Html.EndTR(newContent);
        });

        $('#AlternativeReworkCablesList').html(newContent);
    }

here is my redirect page:

function Redirect() {
    window.open ("http://10.19.13.67/ReworkLabels/Default.aspx","my window");
    return false;
}
billah77
  • 196
  • 1
  • 1
  • 13

2 Answers2

0

You have a few options: You could save the data in a cookie for re-use later, you could pass the data to the next page as a series of GET variables, or you could load the next page using AJAX so that your variables remain available.

Since you're using ASP, you could do something like this:

function Redirect() {
    window.open ("http://10.19.13.67/ReworkLabels/Default.aspx?myVariable=" + myVariable,"my window");
    return false;
}
edcs
  • 3,847
  • 2
  • 33
  • 56
  • 1
    `Since you're using ASP, you could do something like this:` it is not neccessary what he use. You suggest simple query string. It works in web, but not only in asp – Sharikov Vladislav May 09 '14 at 09:54
0

To send big amount of data you can try this:

  1. Create form with method post and action equal to url you want to redirect to (form can be hidden — it is not problem)
  2. Create textarea/text field (not neccessary) in this form
  3. Put your data in this textarea
  4. Submit form via JS
  5. Receive data on new page

Note, that javascript will escape data in this form. To unescape it use unescape() function.

Sharikov Vladislav
  • 7,049
  • 9
  • 50
  • 87