Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

send data from one page to another html page in Javascript

//use this in page one
//where you will send data from
function testJS() {
    var b = document.getElementById('name').value,
        url = 'http://path_to_your_html_files/next.html?name=' + encodeURIComponent(b);

    document.location.href = url;
}
//use the following code where you want to receive data
window.onload = function () {
    var url = document.location.href,
        params = url.split('?')[1].split('&'),
        data = {}, tmp;
    for (var i = 0, l = params.length; i < l; i++) {
         tmp = params[i].split('=');
         data[tmp[0]] = tmp[1];
    }
    document.getElementById('here').innerHTML = data.name;
}
Comment

how to pass the data from one page to another in javascript

var favoritemovie = "Shrek";
sessionStorage.setItem("favoriteMovie", favoritemovie);
Comment

send data to another page javascript

postMessage: exchange data between different domains
Comment

PREVIOUS NEXT
Code Example
Javascript :: firebase update users 
Javascript :: javascript remove last element from array 
Javascript :: js convert special characters to html entities 
Javascript :: datatable giving default width to colums 
Javascript :: js first letter to uppercase 
Javascript :: golang http POST JSON content 
Javascript :: js remove item from array by value 
Javascript :: reverse a number in javascript w3schools 
Javascript :: search substring in string javascript 
Javascript :: javascript string comma seprated price to int 
Javascript :: js get random element in array 
Javascript :: array chaing in js 
Javascript :: getboundingclientrect() javascript 
Javascript :: expressjs path optional parameters 
Javascript :: how to get file extension in javascript 
Javascript :: node get absolute path 
Javascript :: permutation javascript 
Javascript :: check for alphabetic string in javascript 
Javascript :: send message whatsapp javascript 
Javascript :: send form data using fetch 
Javascript :: how to change css style on click 
Javascript :: Warning: Prop `className` did not match. Client and server rendered different classes . 
Javascript :: cancel button in react js 
Javascript :: is java and javascript the same 
Javascript :: javascript create range with a loop 
Javascript :: how to change text in html using javascript 
Javascript :: iframe innerthtml 
Javascript :: listen back button event listner 
Javascript :: jquery find children not working 
Javascript :: react forwardref 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =