Embedded JSON data automatically writes back HTML webpages
This article introduces the solution and technical implementation code for parsing JSON nested strings from MongoDB and displaying data content based on custom attributes of HTML interface elements.
HTML Web Page Def
JSON file has multiple 0.json 1.json 2.json 3.json ...
Now the case is that JS can read the contents of the JSON file, but each time the new file is read the contents of the file is gone, I want to load the contents of the new
Background:Sometimes we need to display the JSON data directly on the page (for example, in an interface test project, we need to show the results of the interface return directly), but if the string is displayed directly, it is not convenient to view. Need to format it.Solution:In fact, json.stringify itself can be formatted JSON, the specific usage is:NULL // Res is the object to be
/left)Solemnly declare: you are welcome to repost this article, but it is strictly prohibited to tamper with it without the consent of the author. infringement is required!
","ReleaseTime": "2014-11-21 "}
$. Ajax ({url: url, ype: 'text', jsonp: 'callback', success: function (json) {// js replace and filter strings, filter json = guolv (json);
information from a personal browser, you canStore the data in an XML file, call it when needed, avoid frequent server interactions and store private information."XPATH"XPath is actually a service to XML. When getting XML file information, you can use the Load method provided by the XML itself, but for developers,This is a more complicated problem. So XPath was born, and it provides a set of methods or paths that make it easier and easier for developers to getThe storage information for XML."
The latest has been the knowledge of Web pages, touching the concept of HTML CSS JAVASCRIPT JSON DOM JQUERY PHP.
1.HTML
H Yper T ext M Arkup L anguage
HTML is not a programming language, but a markup language, similar to XML.
HTML is made up of tags and elements, and our br
Premise: Sometimes it is necessary to load data on another website on a Web page. or load a page on another site. JS Ajax requests do not have cross-domain capabilities and can be implemented using jquery.Web-side JS code:$(function() {$.ajax ({type:"Get", Async:false, URL:"Http://localhost:13964/getpage.ashx?callback=?",//the server-side URL that returns a section of JS data. To return HTML, simply organize the H
Before writing this article, I was doing an order center based on the tab page:Every click of a tab tab will request a list of orders corresponding to the status. Before the project, I will use the + connector in JS to connect multiple HTML content:var html = '+ = ' HTML content is a little bit better, but when the content of the time, and then use this way, late
Article Description:
This article describes a way to generate HTML from a JSON string (simply implement a text box, password box, Drop-down box). Just feel fun to do this, if you feel that there is no value, please ignore. Not enough to point out the hope that you Daniel. Follow-up will be based on your guidance to continue to improve.
function Description:
Enter the
When writing a page with logical repetition, JSON data can significantly improve programming efficiency and facilitate later data maintenance. Therefore, in the video feature page, need to show the multi-column video data, I chose to use JSON. This article mainly tells you how to parse JSON through JavaScript and get the data to add to the
How to obtain and load JSON data through JS in html, jsjson
When writing pages with logic repeatability of content, using json data can significantly improve programming efficiency and facilitate later data maintenance. Therefore, on the video topic page, you need to display multiple video data columns. I chose to use json
1. Download and install jqueryThe following method can be used to introduce the online version of JS:Reference Installation Documentation:http://www.runoob.com/jquery/jquery-install.html 2. Prepare a JSON-formatted file, and the suffix may not be. JSONFor example, the following is the format of Result.json{"title": "UI Test Results"-turn 2017/1/23 14:47 "," starttime": "2017/1/23 15:00"," endtime": "2017/1/23 15:01","Passcount": Ten,"Failurecount": 5,
$.post, $.get is a simple method, if you want to deal with complex logic, still need to use the Jquery.ajax ()I. General format of $.ajax$.ajax ({Type: ' POST ',URL: URL ,Data: data ,Success: Success ,DataType: dataType});Second, the parameter description of $.ajaxParameter description
Url
Necessary. Specifies which URL to send the request to.
Data
Optional. The map or string value. Specifies the data that is sent to the server along with the request.
Title, how does PHP automatically identify third-party RESTful API content and automatically render it into JSON, XML, HTML, serialize, CSV, PHP and other data?In fact, this is not difficult, because the rest API is also based on the HTTP protocol, as long as we follow the protocol, we can do the automation to identify the content of the API, the method is as follows:1, the API server to return the explicit
: This article mainly introduces simple json interaction examples between php and html. For more information about PHP tutorials, see.
Front-end (HTML) code
Simple example of foreground processing json
$ ("Document "). ready (function () {var url = "server2.php"; var data = {"do": "first"}; $. getJSON (u
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.