Skip to content

Instantly share code, notes, and snippets.

@asilbalaban
Created September 18, 2014 13:05
Show Gist options
  • Save asilbalaban/5472b9d14d7462928ade to your computer and use it in GitHub Desktop.
Save asilbalaban/5472b9d14d7462928ade to your computer and use it in GitHub Desktop.
return data from top window (window opener example)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Window</title>
</head>
<body>
<form action="">
<label for="">Müşteri ID <a href="#" id="click">[Gözat]</a></label>
<input type="text" name="musteri_id" id="musteri" value="" placeholder="Müşteri ID bilgisi">
</form>
<script src="jquery-2.1.1.min.js"></script>
<script>
$('#click').click(function(e){
e.preventDefault();
window.open('top.html?&don=musteri_id','ID Seçimi','width=800,height=600');
});
function al (data)
{
$('#musteri').val(data);
}
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>asd</title>
</head>
<body>
<div><a data-albumId="1" rel="<?php echo $_GET['don']; ?>" class="albumId">1 nolu id</a></div>
<div><a data-albumId="2" rel="<?php echo $_GET['don']; ?>" class="albumId">2 nolu id</a></div>
<div><a data-albumId="3" rel="<?php echo $_GET['don']; ?>" class="albumId">3 nolu id</a></div>
<div><a data-albumId="4" rel="<?php echo $_GET['don']; ?>" class="albumId">4 nolu id</a></div>
<div><a data-albumId="5" rel="<?php echo $_GET['don']; ?>" class="albumId">5 nolu id</a></div>
<div><a data-albumId="6" rel="<?php echo $_GET['don']; ?>" class="albumId">6 nolu id</a></div>
<div><a data-albumId="7" rel="<?php echo $_GET['don']; ?>" class="albumId">7 nolu id</a></div>
<div><a data-albumId="8" rel="<?php echo $_GET['don']; ?>" class="albumId">8 nolu id</a></div>
<div><a data-albumId="9" rel="<?php echo $_GET['don']; ?>" class="albumId">9 nolu id</a></div>
<div><a data-albumId="10" rel="<?php echo $_GET['don']; ?>" class="albumId">10 nolu id</a></div>
<div><a data-albumId="11" rel="<?php echo $_GET['don']; ?>" class="albumId">11 nolu id</a></div>
<div><a data-albumId="12" rel="<?php echo $_GET['don']; ?>" class="albumId">12 nolu id</a></div>
<div><a data-albumId="13" rel="<?php echo $_GET['don']; ?>" class="albumId">13 nolu id</a></div>
<div><a data-albumId="14" rel="<?php echo $_GET['don']; ?>" class="albumId">14 nolu id</a></div>
<div><a data-albumId="15" rel="<?php echo $_GET['don']; ?>" class="albumId">15 nolu id</a></div>
<script src="jquery-2.1.1.min.js"></script>
<script>
$(document).on('click', 'a.albumId', function(){
var editor = $(this).attr("rel");
console.log('editor');
var albumId = $(this).attr("data-albumId");
window.opener.al(albumId);
window.top.close();
// window.top.opener.focus();
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment