Ask JSON to get back the data inexplicable in front of the table what's going on
This post was last edited by z57737507 on 2015-10-17 17:00:27
Send JSON file Request File category.php Corresponding tables in the database JSON results Data results in front of many inexplicable don't know where the
The first time you do enterprise-class applications, feel a little: the logic must be very clear, and have a lot of different concepts.
In the Baidu editor, how to complete the value from the server, to render the table? Here we need to console.log (editor), and the official API has told us that the way to write is SetContent (), where we can simply pass in the string that we finally spelled, that we can draw any node we want in the initialization.
Af
Originally the project needs a tree structure, and then randomly chose a easyui tree open source Framework, and then encountered a problem, I want to recursively from the database structure, turn to JSON, how to do? Is it a recursive stitching StringBuilder? It would be foolish to do so. Then all kinds of Baidu, blog Park, QQ Group to ask, the answer is also a variety of, no one to give me detailed, I had to figure it out.First: The
Effect diagram: Drag the red vertical bar to drag the table width left and right, changing the width of the top and bottom
Features: Drag easy, AAA column text drag will not be overwritten, DDD column text will be covered by the form line
Code:
HTML code
Change the column width of table Aaa Ddd Ddd
Paging table data written in pure js is a json string
This article mainly introduces pages written in pure js. The table data is a json string. For more information, see
If you don't want to talk about anything, go directly to the Code:
The Code is as follows:
String path = request. getContextPath ();
String basePa
First, Ajax requests data (using Jquery's Ajax)Copy codeThe Code is as follows: The backend processes the request and returns data in Json format (Thinkphp is used)Copy codeThe Code is as follows:$ List = $ File-> group ('num')-> order ('Id desc')-> limit ($ Page-> firstRow. ','. $ Page-> listRows)-> select ();$ This-> ajaxReturn ($ list, 'json '); Html sectionCo
This article mainly introduces the keyboard encoding table in JSON format. This article provides English key names, corresponding values, and Chinese comments, for more information, see the following section for a JSON-format keyboard encoding table. You are welcome to reprint it, but please indicate the source. Thank
This article mainly introduces the keyboard encoding table in JSON format. This article provides English key names, corresponding values, and Chinese comments, for more information, see the following section for a JSON-format keyboard encoding table. You are welcome to reprint it, but please indicate the source. thank
I simulated a little bit of JSON data stored in a database table, you can simulate{"1": {"id": "1", "Name": "ASD", "type": "1", "Value": "1l,4l"}} {"2": {"id": "2", "Name": "KJF", "type": "1", "Value": "1l,4l"}} {"3": {"id": "3", "Name": "SSS", "type": "1", "Value": "1l,4l"}}The following PHP file I used to execute the PDO Front-end Ajax receive output This article from "Kangjunfei" blog, reproduced pleas
Key,val is not a correspondence in the hash data obtained by Lua-redis.
Data structures are as follows
1 Key1
2 Val1
3 Key2
4 Val2
To make it easier for other language programs to get formatted data, you need to convert it to JSON so that key and Val correspond, and the program makes the following modifications (LUA)
For k,v in pairs (OK) do
For key,val in pairs (v) do
If key%2 = = 0 Then
Send JSON file
Request File
category.php
Corresponding tables in the database
JSON results
Data results in front of many inexplicable don't know where the table data "expression"
What do we do?
Reply to discussion (solution)
That's the wrong message!Your PHP version is greater than or equal to 5.5, so there will be mysql_conn
Use Shell scripts to convert MySQL table data to json format, mysqljson
The script is as follows:
#!/bin/bashmysql -s -phello test >1.log
The data in table t1 is as follows:
mysql> select * from t1;+------+-------+| id | name |+------+-------+| 1 | || 1 | NULL || 2 | hello |+------+-------+3 rows in set (0.00 sec)
The script execution result i
Table user has two fields, Id,name
Table User_friend has three fields, Id,userid,friendid
$query = $this->db->query (' SELECT * from user where id=46 ');
$user = $query->row ();
$queryfriend = $this->db->query (' SELECT * from User_friend where userid= '. $user->id);
$userfriend = $queryfriend->result ();
Dear friends, I would like to output the following JSON
Label:No good tool found, only thought of the way to spell the string, with NVARCHAR(MAX) may have truncated, deprecated, the method uses the for XML PATH (" ) Implementation, refer here for its use method Table structure: SQL statements: SELECT '{"id":'+CONVERT(NVARCHAR( -), id)+', "AreaCode":'+AreaCode+', "AreaName": "'+AreaName+'" ," Paremt_areacode ":'+Paremt_areacode+'},' fromHk_dic_countrycode forXML PATH ("') Execution Result: After f
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.