Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h2>IDs</h2> <p>IDs <strong>MUST</strong> be unique document-wide!<br> HTML4 DTD (<a href="http://www.w3.org/TR/html4/sgml/dtd.html" rel="nofollow">http://www.w3.org/TR/html4/sgml/dtd.html</a>):</p> <pre><code>&lt;!ENTITY % coreattrs "id ID #IMPLIED -- document-wide unique id -- class CDATA #IMPLIED -- space-separated list of classes -- style %StyleSheet; #IMPLIED -- associated style info -- title %Text; #IMPLIED -- advisory title --" &gt;; </code></pre> <p>You are looking for jQuery.serializeArray (<a href="http://api.jquery.com/serializeArray/" rel="nofollow">http://api.jquery.com/serializeArray/</a>) </p> <h2>Example</h2> <pre><code>$('input[type="button"]').click(function( var formData = $(this).closest('form').serializeArray(); $.ajax({ url: '...', method: 'POST', data: { form: formData } }); )); </code></pre> <p>Server side:</p> <pre><code>&lt;?php $formData = array(); if (!empty($_POST['form']) &amp;&amp; is_array($_POST['form'])) { foreach ($_POST['form'] as $element) { if (empty($element['name']) || empty($element['value'])) { continue; } $formData[$element['name']] = $element['value']; } unset($_POST['form']); } var_dump($formData); // &lt;-- See structured output </code></pre> <p><em>(untested)</em></p> <h2>Docs</h2> <ul> <li><a href="http://www.w3.org/TR/html4/sgml/dtd.html" rel="nofollow">http://www.w3.org/TR/html4/sgml/dtd.html</a></li> <li><a href="http://api.jquery.com/serializeArray/" rel="nofollow">http://api.jquery.com/serializeArray/</a></li> <li><a href="http://api.jquery.com/closest/" rel="nofollow">http://api.jquery.com/closest/</a></li> <li><a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow">http://api.jquery.com/jQuery.ajax/</a></li> <li><a href="http://www.php.net/manual/en/control-structures.foreach.php" rel="nofollow">http://www.php.net/manual/en/control-structures.foreach.php</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload