In the android phonegap application i need to get the script of index2.html from index1.html using javascript or jquery.
Here is index1.html code:
function nextpage(){
$.get('index2.html', function(data) {
$('#div').html(data);
alert('Load was performed.');
});
}
<input type="button" value="button1" onclick="nextpage()"/>
<div id="div"></div>
Here is index2.html code:
function return1()
{
alert("welcome to index2.html");
var data={ "firstName": "John", "lastName": "Doe", "age": 25 };
}
<input type="button" value="welcome" onclick="return1()"/>
From this code i am getting the 'welcome' button from index2.html and appended in #div of index1.html.But i need to append the return1() in #div and need to get the alert("welcome to index2.html").That is html page function response.How to do this.Please help me.Thanks in advance.