开发者

jqgrid: get return value from json data

How can I get a return value from a json string?

For example, in the code below, how can I parse and read the variable searchxx?

From PHP:

$responce->page = $page; 
$responce->total = $total_pages; 
$responce->records = $BC->tot_count; 
**$responce->searchxx = $sSchWhere;
$responce->order = $sOrder;**

while ($data) ......

echo json_encode($responce);

From HTML (Firebug):

"page":"1","total":2,"records":"26",**"searchxx":"T0.NAME=pluto"** ,"order":"T0.NAME desc","rows":[{"id":"63025c7a-12ad-102c-bd62-005056801340","account_id":"c30c7934-e0f3-102b-8fd4-005056801340","actions":"","edtNAME":"Rossi Mario","edtACCOUNT_NAME":"<a href=\#\">Rossi Mario<\/a>","ed开发者_C百科tAREA":"DEMO","edtSTATUS":"Aperta","edtPRIORITY" ......etc.

I have this code:

jQuery("#list2").navGrid('#pager2'{edit:false,add:false,del:false,search:false,refresh:false})
       .navButtonAdd('#pager2',{   
       caption:"View Condition Where",    
       buttonicon:"ui-icon",    
       onClickButton: function(){

           alert($("#list2").getGridParam('searchxx')); **//Should output NULL**
           },     position:"last" });

How can I get the return value searchxx from jsondata?


Convert JSON string into array using json_decode()

Example:

$array = json_decode($your_json_string);
echo $array['searchxx']; // Should output "T0.NAME=pluto"


I reckon http://www.json.org/js.html should help. If not, check out libraries, jQuery, MooTols, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜