Skip to content

Instantly share code, notes, and snippets.

@OndraM
Created April 16, 2012 19:41
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 OndraM/2401014 to your computer and use it in GitHub Desktop.
Save OndraM/2401014 to your computer and use it in GitHub Desktop.
jQuery form plugin issue #180 demo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css" media="screen" rel="stylesheet" type="text/css" >
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://malsup.github.com/jquery.form.js"></script>
</head>
<script>
$(document).ready(function() {
$('#ajax-form').ajaxForm({
target: $('#ajax-form-target')
});
$('form').submit();
})
</script>
<body>
<p>
Both forms send empty on document ready.
</p>
<h2>Ajax form (result shown in target)</h2>
<form id="ajax-form" method="post" enctype="multipart/form-data" action="post.php">
<input type="file" name="file">
<input type="submit" value="Send">
</form>
<pre id="ajax-form-target" style="border: 1px solid black;"></pre>
<h2>Standard form (result shown in iframe)</h2>
<form method="post" enctype="multipart/form-data" action="post.php" target="iframe">
<input type="file" name="file">
<input type="submit" value="Send">
</form>
<iframe name="iframe" src="post.php" style="border: 1px solid black;"></iframe>
</body>
</html>
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST") {
var_dump($_FILES);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment