Skip to content

Instantly share code, notes, and snippets.

@Rio517
Last active October 4, 2015 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rio517/2704356 to your computer and use it in GitHub Desktop.
Save Rio517/2704356 to your computer and use it in GitHub Desktop.
Example: Submit post requests across domains using an intermediary targeted Iframe.
<form action="http://anotherdomain/save" method="post" target="myiframe" id="myform">
<!-- standard form here -->
</form>
<iframe src="about:blank" name="myiframe" style="display: none;"></iframe>
<!-- Then, javascript something like: -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#myform').on('submit', function(e){
e.preventDefault();
//if(validates){
$(e).submit();
// }
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment