How can I retrieve values from the iframe form id, and call it to my client side html.
(client side html) sample.html
<head>
<script>
function alertThis(){
alert(parent.myframe.formsubmit.a_token.value);
}
</script>
</head>
<body>
<iframe name = "myframe" src="http://domain.com/sample/index.php">
<button onClick = "alertThis();">Click Here</button>
</body>
(server side php) index.php
<form name = "formsubmit">
<input id = "a_token" value="<?php echo $_SESSION['user'] ?>"/>
</form>
but it does not return any.
var doc = window.frames['myframe'].document.getElementById('a_token').value; alert(doc);
try this.
Try this codepeace
<iframe name="myframe" id="myframe" src="http://domain.com/sample/index.php">
function alertThis(){
var content = window.frames['myframe'].document.forms['formsubmit'].elements['a_token'].value;
alert(content);
}
EDIT
Same issue has sorted using jQuery
$('#myframe').contents().find('a_token').val()