Last active
December 18, 2015 08:49
-
-
Save Xiphe/5756516 to your computer and use it in GitHub Desktop.
Parameterübergabe an Popups
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Parameter Uebergabe JS</title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
jQuery(document).ready(function() { | |
$('#preview_link').click(function(event) { | |
event.preventDefault(); | |
var popup = window.open( | |
'preview.html', | |
'Vorschau', | |
'scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,status=no' | |
); | |
}); | |
window.getForm = function() { | |
return $('#form').serializeArray(); | |
}; | |
}); | |
</script> | |
</head> | |
<body> | |
<form id="form"> | |
<input name="foo" value="bar" /> | |
<input name="fop" value="bas" /> | |
<input name="foq" value="bat" /> | |
<input name="for" value="bau" /> | |
<input name="fos" value="bav" /> | |
<input name="fot" value="baw" /> | |
</form> | |
<a href="#preview" id="preview_link">Preview</a> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Parameter Empfaenger JS</title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
var parent = window.opener; | |
$.each(parent.getForm(), function(i, input) { | |
$('body').append('<div>'+input.name+': '+input.value+'</div>'); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment