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 :: Star Wars Celebration 
Javascript :: a critical point in an array is defined as either a local maxima or a local minima 
Javascript :: react using props and parent state 
Javascript :: draft save using jquery 
Javascript :: check if function exists 
Javascript :: how to uitree clone in jquery 
Javascript :: vue compositon api reusable code reuse code 
Javascript :: Will Yield An Object 
Javascript :: [jQuery] Moving elements in dom 
Javascript :: jqxAngular 
Javascript :: javascript Least prime factor of numbers till n 
Javascript :: ajaxpost 
Javascript :: Simplest Template Example 
Javascript :: how to filter through an array of objects 
Javascript :: how to get header in node controller 
Javascript :: make navigation open when items are active 
Javascript :: kayengxiong promise js 
Javascript :: react Dark/Light mode 
Javascript :: aysnc and await response data usage 
Javascript :: verifier si chaien ade caractere apparait dans autre js 
Javascript :: javascript array every 
Javascript :: regex for erlang online 
Javascript :: canvas squashed video javascript 
Javascript :: onClick: share image on Facebook angular 9 
Javascript :: $( ) jquery 
Javascript :: prompt dentro de una funcion javascript 
Javascript :: html5 javascript json vertical colom grap 
Javascript :: Multiple Locale Support momentjs 
Javascript :: javascript vuelidate identical passwords only if checkbox is ticked 
Javascript :: How to add ui-scroll with remote data in angularjs 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =