Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Ronak Panchal 71 posts 230 karma points
    Dec 14, 2015 @ 13:02
    Ronak Panchal

    Pass data from one page to another on anchor tag click.

    Hello all,

    I want to send data from my one page to another on link.

    Below code is in template.

    var abc = "hello";    
    <a href="result">uk</a>

    I want this var abc value "hello" in page result.

    Any help would be much appreciated !


    Ronak Panchal.

  • Steve Morgan 1301 posts 4351 karma points c-trib
    Dec 14, 2015 @ 14:40
    Steve Morgan

    Hi Ronak,

    is this data generated on the page load or by something the user does on the page?

    If on the page load you can just do:

    var abc = "hello";    
    <a href="[email protected]">uk</a>

    That will pass the variable to the result page on a URI variable. You can easily get this via:

    var abcFromUrl = Request.QueryString["abc"] ?? string.Empty;

    If it's based on a user selection on the page without a page reload then you could easily set a URL variable or cookie in Javascript or set a session variable via AJAX - lots of ways of doing this, depends on what you're doing.


Please Sign in or register to post replies

Write your reply to: