Skip to content

Instantly share code, notes, and snippets.

@laxman954
Created November 12, 2016 17:33
Show Gist options
  • Save laxman954/f59e46f6540b074b6529b94bd7b39821 to your computer and use it in GitHub Desktop.
Save laxman954/f59e46f6540b074b6529b94bd7b39821 to your computer and use it in GitHub Desktop.
<html>
<head>
<script type="text/javascript" src="http://www.sirpigal.org/js/jquery.core.js"></script>
<script>
$(document).ready(function(){
$('#myform').submit(function() {
// console.log($('#result').text(JSON.stringify($('form').serializeObject())));
console.log(JSON.stringify($(this).serializeArray()));
return false;
});
});
</script>
</head>
<body>
<form id="myform" action="" method="post">
<div class="form-field">
<label for="title">Title</label>
<input name="title" id="title" type="text" value="" size="40" aria-required="true">
</div>
<div class="form-field form-required">
<label for="your-name">Your Name</label>
<input name="yourName" id="yourName" type="text" value="" size="40" aria-required="true">
</div>
<div class="form-field">
<label for="contact-no">Contact No:</label>
<input name="contact" id="contact" type="text" value="" size="40" aria-required="true">
</div>
<div class="form-field">
<label for="description">Description:</label>
<textarea name="description" id="description" rows="1" cols="40" aria-required="true"></textarea>
</div>
<div class="form-field">
<label for="email">Email:</label>
<input name="email" id="email" type="text" value="optional" size="40" aria-required="true">
</div>
<div class="form-field">
<label for="city">City:</label>
<input name="city" id="city" type="text" value="" size="40" aria-required="true">
</div>
<div class="form-field">
<label for="country">Country:</label>
<input name="country" id="country" type="text" value="" size="40" aria-required="true">
</div>
<div class="form-field">
<label for="pic1">Picture 1:</label>
<input type="file" name="pic1" id="pic1">
</div>
<div class="form-field">
<label for="pic2">Picture 2:</label>
<input type="file" name="pic2" id="pic2">
</div>
<div class="form-field">
<label for="pic3">Picture 3:</label>
<input type="file" name="pic3" id="pic3">
</div>
<div class="form-field">
<label for="pic4">Picture 4:</label>
<input type="file" name="pic4" id="pic4">
</div>
<div class="form-field">
<label for="pic5">Picture 5:</label>
<input type="file" name="pic5" id="pic5">
</div>
<div class="form-field">
<label for="demand">Your Demand:</label>
<input name="demand" id="demand" type="text" value="" size="40" aria-required="true">
</div>
<p class="submit">
<input type="submit" name="postAd" id="postAd" class="button" value="Post Ad For Review">
</p>
<div id="results">hello</div>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment