There are two forms that I have defined as follows:
Home.jsp:-
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
@import "../Script/dojo-1.10/dijit/themes/claro/claro.css";
</style>
<script type="text/javascript">
dojoConfig = {
isDebug: true,
parseOnLoad : true
}
</script>
<script type="text/javascript" lang="JavaScript" src="../Script/dojo-1.10/dojo/dojo.js"></script>
<script type="text/javascript">
require(["dojo/parser","dijit/form/Button",
"dojo/domReady!"],function(parser){
//parser.parse();
alert("From Require");
});
function getWelcomeJsp(){
var loadResponse = dojo.byId("loadResponse");
dojo.xhrPost({
url:"Welcome.jsp",
handleAs:"text",
load:function(data){
dojo.style(loadResponse,"display","block");
loadResponse.innerHTML = data;
return data;
},
error:function(err){
alert("error"+err);
}
});
}
</script>
</head>
<body class="claro">
<table>
<tr><td valign="bottom">
<a href="Welcome.jsp">This Is Hyperlink</a>
</td></tr>
<tr>
<td>
<label for="empId">EmpId:</label>
<input id="empId" data-dojo-type="dijit/formTextBox"
type="text"/>
</td></tr><tr><td>
<button data-dojo-type="dijit/form/Button" id="buttonId" onclick="getWelcomeJsp();">Send</button>
</td></tr></table>
<div id="loadResponse"></div>
</body></html>
Welcome.jsp:-
<!DOCTYPE html>
<html><head>
<style type="text/css>"
@import "../Script/dojo-1.10/dijit/themes/claro /claro.css";</style>
<script type="text/javascript" lang="JavaScript" src="../Script/dojo-1.10/dojo/dojo.js"> </script>
<script type="text/javascript" lang="JavaScript">
require(["dojo/parser","dojo/ready"],function(parser,ready){
dojo.ready(function(){
parser.parse();
alert("From Ready");
});
});
function myfunction(){
alert("from welcomedd JSP");
}
</script></head>
<body class="claro" onload="myfunction();">
This Is Welcome JSP
<button id="responseButton" data-dojo-type="dijit/form /Button" onclick="myfunction();">Response Button</button>
</body></html>
When clicking on the hyperlink in Home.jsp using dojo 1.9 version, Thank you". The issue arises when attempting to load the Welcome.jsp through an ajax call from Home.jsp.
The problem is that while Welcome.jsp gets loaded through ajax, the ready function and onload function within Welcome.jsp are not being called. Any solutions or insights into this issue would be greatly appreciated.