Note that there are some explanatory texts on larger screens.

plurals
  1. POcodeigniter datatables get data from form
    primarykey
    data
    text
    <p>Pls help basically I want to filter my datatable using form.</p> <p>each input has a value that would affect the query with submitted form.</p> <p>here is my JQUERY.</p> <pre><code>$("#submit").click(function (e) { $('#table').dataTable ({ "sAjaxSource": "index.php/report/get_report", "sServerMethod": "POST", 'fnServerData': function (url, data, callback) { // Add new data dataString = $("#myform").serialize(); $.ajax({ 'url': "index.php/report/get_report", 'data': dataString, 'type': 'POST', 'success': callback, 'dataType': 'json', 'cache': true }); }, 'bServerSide' : true, "aaSorting": [[ 3, "desc" ]], "bPaginate": true, "bSortClasses": false, "bAutoWidth": true, "bInfo": true, "iDisplayLength" : 3, "bScrollCollapse": true, "oLanguage": { "sSearch": "Search:" }, "bDestroy": true }); }); </code></pre> <p>and this is my HTML FORM</p> <pre><code>&lt;form name="myform"&gt; &lt;label&gt;Employee:&lt;/label&gt; &lt;input type="text" name="employeeid" id="employeeid" title="Type Employee" /&gt; &lt;label&gt;Training Type: &lt;/label&gt; &lt;select name="trainingtype" id="trainingtype" &gt; &lt;option value="" selected="selected"&gt;All&lt;/option&gt; &lt;option value="1"&gt;Externally Facilitated Training&lt;/option&gt; &lt;option value="3"&gt;Internally Facilitated Training&lt;/option&gt; &lt;option value="2"&gt;Webcast/E-Learning&lt;/option&gt; &lt;/select&gt; &lt;label&gt;Datestart&lt;/label&gt; &lt;input type="text" class="field size3" name="datestart" id="datepicker_s" /&gt; &lt;label&gt;Dateend &lt;/label&gt; &lt;input type="text" class="field size3" name="dateend" id="datepicker_e" /&gt; &lt;input type="hidden" id="txtsearchid" name="txtsearchid"&gt; &lt;input type="button" class="button" value="Submit" id="submit" /&gt; </code></pre> <p></p> <p>when I submit my form I get nothing.</p> <p>Im I doing the right way?</p> <p>pls help.</p> <p><strong>GOT IT</strong> </p> <pre><code>"fnServerData": function ( sSource, aoData, fnCallback ) { //REQUIRED: Add a Post variable with the object value aoData.push( { "name": "txtsearchid", "value": $( "#txtsearchid" ).val() }, { "name": "datestart", "value": $( "#datepicker_s" ).val() }, { "name": "dateend", "value": $( "#datepicker_e" ).val() }, { "name": "trainingtype", "value": $( "#trainingtype" ).val() } ); $.ajax( { dataType: 'json', type: "POST", url: sSource, data: aoData , success: fnCallback } ); }, </code></pre> <p>this must be the solution for my problem. I didnt used the serialized instead of push</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.
    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