jquery - search via fnServerData in datatables plugin issue -
i want pass data server page search with,i echo/print query on server file not concatenate if provide more 1 parameters.it shows last provided param in where.here code
"fnserverdata": function ( ssource, aodata, fncallback ) { /* add data sender */ aodata.push( { "name": "type", "value": $('#type_dummy').val() }, { "name": "category_id", "value": $('#category_id').val() }, { "name": "region_id", "value": $('#region_id').val() } ); $.getjson( ssource, aodata, function (json) { /* whatever additional processing want on callback, tell datatables */ fncallback(json) } ); }
on server side processing file have this
$swhere = ""; if ( $_get['ssearch'] != "" ) { $swhere = "where ("; ( $i=0 ; $i<count($acolumns) ; $i++ ) { $swhere .= $acolumns[$i]." '%".mysql_real_escape_string( $_get['ssearch'] )."%' or "; } $swhere = substr_replace( $swhere, "", -3 ); $swhere .= ')'; } /* individual column filtering */ ( $i=0 ; $i<count($acolumns) ; $i++ ) { if ( $_get['bsearchable_'.$i] == "true" && $_get['ssearch_'.$i] != '' ) { if ( $swhere == "" ) { $swhere = "where "; } else { $swhere .= " , "; } $swhere .= $acolumns[$i]." '%".mysql_real_escape_string($_get['ssearch_'.$i])."%' "; } } if(isset($_get['type']) && $_get['type'] != '' ){ $swhere = "where rent.type = '$_get[type]' "; } if(isset($_get['category_id']) && $_get['category_id'] != '' ){ $swhere = "where rent.category_id = '$_get[category_id]' "; }
i run server side file directly in url , pass both parameters in url , print query,it shows 1 param in link is
/view_match_lead_server.php?type=1&category_id=1
query's this(other query ok )
where category_id=1
if question still active:
three steps / issues:
i have resolved same issue. using "fnserverdata() 3 parameters, used fnserverparams() 1 parameter - aodata. 3 additional parameters in aodata.push similar yours.
secondly, use firebug ensure sending additional parameters in url $_get obtain correctly. essential clear history in browser ensure not interfering changes.
finally have comprehensive class function server php bit, difficult (but not impossible) use solution server script. if question still active , unresolved, provide more detailed analysis of php script.
Comments
Post a Comment