Unable to get data from content in jQuery?
Posted
by
Srikanth Chilukuri
on Stack Overflow
See other posts from Stack Overflow
or by Srikanth Chilukuri
Published on 2012-09-17T06:49:50Z
Indexed on
2012/09/17
9:38 UTC
Read the original article
Hit count: 197
I have 2 HTML files and 2 js files.
In App.html I want to include login.html and need to fetch the data from login.html and need to use in in App.
App.html
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src='js/jquery.js'></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/login.js"></script>
</head>
<body>
<div id="content"></div>
</body>
</html>
Login.html
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src='js/jquery.js'></script>
</head>
<body>
<div>
<div data-role="fieldcontain">
<label for="userid" id="luserid" ><strong>UserId : </strong></label>
<input type="text" name="userid" id="userid" value="" class="logon" placeholder="Username" required/>
</div>
<div data-role="fieldcontain">
<label for="password" id="lpassword"><strong>Password :</strong></label>
<input type="password" name="password" id="password" class="logon" value="" placeholder="Password" required/>
</div>
<div class="ui-body">
<fieldset class="ui-grid-a">
<div class="ui-block-a"><a data-role="button" id="loginbtn" data-theme="b">Login</a></div>
</fieldset>
</div>
</div>
</body>
</html>
app.js
$(document).ready(function(){
$('#content').load('login.html');
});
login.js
$(document).ready(function(){
var userid= $("#userid").val();
var upassword= $("#password").val();
alert(userid);
alert(upassword);
});
Please help me out on this.
Note: I do not want to include the login.js in the Login.html.
© Stack Overflow or respective owner