Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Sending parameters

javieretejavierete Posts: 13Member
How can I send values from one page to another with javascript??

Comments

  • bgibbybgibby Posts: 251Member
    : How can I send values from one page to another with javascript??
    :

    Send the data as a Query String.

    Page 1:

    [code]





    function sendData() {
    var data = document.mf.data.value;
    var url = "page2.html";

    document.location.href = url + "?" + data;
    return false;

    }





    Data to Send:




    [/code]

    Page 2:

    [code]





    var receivedData = document.location.search.substring(1, document.location.search.length);





    The data that was sent to this page is:

    document.write(receivedData);





    [/code]

    You can write the code to seperate the Key/Value pairs!

    Cya
    Bradley q:)
  • mac_doggiemac_doggie Posts: 488Member
    : How can I send values from one page to another with javascript??
    :

    I've created a script that allows you to send variables like this:
    [code]
    document.location.href=MyPage.html?Variable1=value&variable2=value&variable3=value etc.
    [/code]

    just download it from my homepage www.mac-doggie.nl
    ;-)
    -mac-
    mailto:programmersheaven@mac-doggie.nl
    the Netherlands...


  • borislavborislav Posts: 16Member
    : How can I send values from one page to another with javascript??
    :
    The both methods have a weak sides the user see the sending data onto browse address bar also the better way to send data to one page may be done by 2 additional ways. Or simply using the Post methods to hide data from browser location bar. Also escape characters are not interpreted well which give possibility of hackers attacks.
    Better and easy way to use document cookies.
    Remember that boys when you want your sites to be better secured.


Sign In or Register to comment.