Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax post form data
    primarykey
    data
    text
    <p>I have the following form</p> <pre><code>&lt;form id="reportcriteriaform"&gt; &lt;div id="reportdialog_dialog" title="New Report" link="/newreport" class="modal show fade in" style="overflow:hidden;text-align:center;" aria-hidden="false"&gt; &lt;div class="modal-header"&gt; WI's Resolved Report &lt;/div&gt; &lt;div class="modal-body"&gt; &lt;div class="row-fluid"&gt; &lt;div class="span6"&gt; &lt;!-- Main report criteria fields go here --&gt; &lt;div id="reportStartDate_row" class="control-group text-left"&gt; &lt;label class="control-label bold" for="reportStartDate"&gt; &lt;label for="reportStartDate"&gt;Start Date&lt;/label&gt; &lt;/label&gt; &lt;div class="controls"&gt; &lt;div class="input-append date datepicker control-group" data-date-format="dd-M-yyyy"&gt; &lt;input type="text" id="reportStartDate" name="reportStartDate" data-date-format="dd-M-yyyy" bs-datepicker="" class="input-large" value=""&gt; &lt;span class="add-on"&gt;&lt;i class="icon-th" id="fromBtn"&gt;&lt;/i&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="reportEndDate_row" class="control-group text-left"&gt; &lt;label class="control-label bold" for="reportEndDate"&gt; &lt;label for="reportEndDate"&gt;End Date&lt;/label&gt; &lt;/label&gt; &lt;div class="controls"&gt; &lt;div class="input-append date datepicker control-group" data-date-format="dd-M-yyyy"&gt; &lt;input type="text" id="reportEndDate" name="reportEndDate" data-date-format="dd-M-yyyy" bs-datepicker="" class="input-large" value=""&gt; &lt;span class="add-on"&gt;&lt;i class="icon-th" id="fromBtn"&gt;&lt;/i&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Maultiselect box goes here --&gt; &lt;/div&gt; &lt;div class="span6"&gt; &lt;p&gt; &lt;button type="button" name="runQuery" id="runQuery" class="btn btn-mini btn-primary " value=""&gt;Run Query&lt;/button&gt; &lt;/p&gt; &lt;p&gt; &lt;button type="button" name="close" id="close" class="btn btn-mini btn-primary " value=""&gt;Close&lt;/button&gt; &lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>When i submit it using the following ajax call, I do not see any data in request.data or request.form</p> <pre><code>$.ajax({ url: '/newreport', type:'POST', data:$('#reportcriteriaform').serialize(), dataType: 'text/html', success: function(data) { // Success stuff } }); </code></pre> <p>newreport.py</p> <pre><code>from flask import render_template, request, session def post(self): request.data //This is empty string request.form //This is empty dictionary #Other stuff </code></pre>
    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.
    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