Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Demostracion de serializeArray() de JQuery
if (isset($_POST['first_name'])){
echo json_encode($_POST);
<title>Test Serialize Array</title>
<script src=""></script>
$(document).on('click', '#btnSubmit', function(){
var forma = $('#data_form').serializeArray();
$.post(window.location.pathname, forma, function(r){
var res = $.parseJSON(r);
<form id="data_form" method="post">
<input type="text" id="first_name" name="first_name" placeholder="First Name"/>
<input type="text" id="last_name" name="last_name" placeholder="Last Name"/>
<textarea id="description" name="description" placeholder="Description"></textarea>
<input type="button" id="btnSubmit" value="Show Data">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment