Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot access data from jQuery Ajax request, returns empty array
    primarykey
    data
    text
    <p>I have a form that is called via the <a href="http://fancybox.net/blog" rel="nofollow noreferrer">fancybox plugin</a> login example.</p> <p>Here is the code I have:</p> <p>Form:</p> <pre><code>&lt;form method="post" action="" id="events_form"&gt; &lt;p class="clearfix"&gt;&lt;label for="Name"&gt;Name:&lt;/label&gt; &lt;input type="text" name="Name" id="Name" /&gt;&lt;/p&gt; &lt;p class="clearfix"&gt;&lt;label for="Company"&gt;Company:&lt;/label&gt; &lt;input type="text" name="Company" id="Company" /&gt;&lt;/p&gt; &lt;p class="clearfix"&gt;&lt;label for="Email"&gt;Email:&lt;/label&gt; &lt;input type="text" name="Email" id="Email" /&gt;&lt;/p&gt; &lt;p class="clearfix"&gt;&lt;label for="Tel"&gt;Tel:&lt;/label&gt; &lt;input type="text" name="Tel" id="Tel"/&gt;&lt;/p&gt; &lt;p class="clearfix"&gt;&lt;input type="submit" value="Submit details" /&gt;&lt;/p&gt; &lt;/form&gt; </code></pre> <p>JavaScript / jQuery:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#event_trigger").fancybox({ 'padding' : 0, 'scrolling' : 'no', 'titleShow' : false, }); $("#events_form").bind("submit", function() { $.fancybox.showActivity(); $.ajax({ type : "POST", cache : false, url : "/events/index.php", data : $(this).serializeArray(), success: function(data) { $.fancybox(data); } }); return false; }); }); &lt;/script&gt; </code></pre> <p>The PHP file returns and empty array. However the <a href="http://en.wikipedia.org/wiki/Firebug_%28software%29" rel="nofollow noreferrer">Firebug</a> post tab displays the form data.</p> <p>Also, I noticed that if I do</p> <pre><code>print_r($_SERVER['REQUEST_METHOD']) </code></pre> <p>This returns GET, even though I have specified POST.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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