Sending some data through URL for external html page by using the following method.

Ex: this code has in page1.html page

window.location=”http://192.168.1.70:81/project/page2.html?v1=”+dada1+”&v2=”+dada2;
page2.html page should have the below function

function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split(“&”);
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split(“=”);
if(pair[0] == variable){return pair[1];}
}
return(false);
}

Retrieving query string parameters in page2.html

var getvl1= getQueryVariable(“v1″);
getv1=getvl1.replace(/%20/g,” “);
alert(v1);
var getvl2= getQueryVariable(“v2″);
getv2=getvl2.replace(/%20/g,” “);
alert(v2);

709 Total Views 2 Views Today

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>