javascript - Filtering Results with JQuery.grep in PHP from Json Txt File -
i'm able pull json results table no problem, when comes filtering results based on php $_get
variables can't seem return result set.
my table simple:
<table id="displaythatdata"> <thead> <tr> <th>meter</th> <th>address</th> <th>city</th> <th>date</th> <th>status</th> <th>location</th> </tr> </thead> <tbody> <tr> <td>that</td> <td>that2</td> <td>that3</td> <td>that4</td> <td>that5</td> <td>that6</td> </tr> </tbody> </table>
my jquery function looks this. trying append table results $_get
variables set using php:
json_return = []; jquery(function(){ jquery.getjson('./json/acm2.txt',{},function(data){ json_return = data; jquery('#displaythatdata').eq(0).html(''); jquery(json_return).each(function(indx,val){ var returneddata = $.grep(json_return, function(element, index){ return element.plat = <?php echo $getthedivision ?>; return element.division = <?php echo $getthedivision ?>; jquery('#displaythatdata').eq(0).append('<tr> <td>'+returneddata.meter+'</td><td>'+returneddata.locaddress+'</td> <td>'+returneddata.city+'</td><td>'+returneddata.inspection_datetime+'</td> <td>'+returneddata.inspection_status+'</td><td>'+returneddata.loc+'</td> </tr>'); }); }); });
my php standard:
$getthedivision = $_get['getregion']; $gettheplat = $_get['getplat'];
my json looks like:
[{"id":1,"uuid":"5d2f830-8757-f80fa715a78e","spid":86810,"meter":"900a","locaddress":"123 meadow rd","city":"santa ana","division":"san diego","plat":"1145-c08","address_num":123,"address_evodd":1,"address_street":"meadow rd","grd_below_su":null,"grd_above_su":null,"manifold_meter":null"},
any ideas on why can return result set based on php $_get
variables? able print them out know being set. saw .grep()
way filter using jquery json. case objects too?
Comments
Post a Comment