1. HTML processing is relatively simple and can be output directly.
Generally, you can use $ ("jb51div"). innerhtml, etc.
2. JSON format data callingCopyCodeThe Code is as follows: $. Ajax ({URL: "/trundle/rawcontentaction. getajaxcontent. Act ",Data: "param1 = 22 ",Datatype: "JSON", // The datatype here is the returned data format in
ArticleDirectory
Same domain:
Cross-origin:
1. Invalid label Error
There are two scenarios:
Same domain
Cross-Origin
Same domain:
Use eval to translate the returned JSON into response
VaR JSON = eval ('+ myjson + ')');Cross-origin:
First, the URL has callback =?
Second, we also need to output the callback value during the output.
$ Dal = $ _ Get ['callback'];
Echo $ Dal. '('. json_encod
[JavaScript.6] Summary of phase concepts: HTML + CSS + JavaScript + xml + xpath + Json + Ajax[Preface]
Recently I learned a lot about BS new things, including many new names, concepts, and misunderstandings. Today, let's take a look at what we learned.
A conceptual summary. This article is mostly a conceptual personal understanding, hoping that the friends who have the same doubts will be suddenly enlighten
The main is to escape the JSON unrecognized charactersfunction Dotran ($STR) {$str = Str_replace (' "', '//" ', $str);$str = Str_replace ("/r/n", '//r//n ', $str);$str = Str_replace ("/t", '//t ', $str);$str = Str_replace ("//", '//', $STR);$str = Str_replace ("/b", '//b ', $str);return $str;}The returned data will be displayed as expected, and the following is the converted content:Jsontext= ' {"Jqry": [{"id": "121", "userid": "0", "status": "1", "fi
The main is to escape the JSON unrecognized charactersfunction Dotran ($STR) {$str = Str_replace (' "', '//" ', $str);$str = Str_replace ("/r/n", '//r//n ', $str);$str = Str_replace ("/t", '//t ', $str);$str = Str_replace ("//", '//', $STR);$str = Str_replace ("/b", '//b ', $str);return $str;}The returned data will be displayed as expected, and the following is the converted content:Jsontext= ' {"Jqry": [{"id": "121", "userid": "0", "status": "1", "fi
Use of the jQuery form plugin -- Process JSON, XML, HTML data returned by the server, and jqueryjson
Code details:
Create a json. jsp file:
Create an xml. jsp file:
Create an html. jsp file:
Since my last AJAX project I ''ve increasingly been wondering about the "ideal" output format for the AJAX response. once you ''ve succesfully fired an AJAX request, what sort of response shoshould the server give? An XML document? An HTML snippet? A json string which is converted to a JavaScript object? Or something else? In this entry I 'd like to discuss the three formats, with examples, and ask you whic
HTML code, CSS code, JSON string online formatting, beautification tool, cssjson
HTML code, CSS code, JSON string online formatting, beautification Tool
Http://www.phpthinking.com/format.htm
What is the working principle of the online HTML formatting tool and the online CSS
today on GitHub, inadvertently find Victorporof share htmlpretty plug-in, special recommendation;Let's see how he describes Htmlpretty:
This is a Sublime Text 2 and 3 plugin allowing your to format your HTML, CSS, JavaScript and JSON code. It uses a set of nice beautifier scripts made by Einar Lielmanis. The formatters is written in JavaScript, so you ll need something (node. js) to interpret JavaS
There are many ways to achieve national provincial/municipal linkage. This article will introduce you to how to implement JSON + HTML. For more information, see
The Code is as follows:
Json
: not persistent; After the event, if the data is not saved, then the data is lost, stateless, only the text can be obtained from the event, but the text is not known which element; use case: Applet; only a small amount of XML documents, little back access, less machine memory;3. JDOM: Based on the tree structure, it uses pure Java technology to parse, generate, serialize and manipulate XML documents. (http://jdom.org)Directly for Java programming services. It leverages the many features of the
function deletehtml ($SCR)
{
$l = strlen ($SCR);
for ($i =0; $i {if (substr ($SCR, $i, 1) = = "{Current position$ii = $i;
Stop looping when $i is greater than character lengthwhile (substr ($SCR, $i, 1)! = "> $i $i + +;
Resets the $i to the beginning of the ' if ($i = = $l){$i = $ii-1;means the end of the string is reached$b = 1;}
$i + +;}
The next character is not ' if (substr ($SCR, $i, 1)! = ' $str = $str. substr ($SCR, $i, 1);Else$i--;}
return ($STR);}
The above describes the
OnePrepare the background test data, the process is slightlySecond, the client processing@{Viewbag.title="Index";}"width:600px;"> "Background-color:lightgray"> "Btnajax"Name="Btnajax"Type="Button"Value="Get Meals"/> "Meals"style="Background-color:lightskyblue">"Jsonresult"style="Background-color:lightsalmon">"Background-color:lightpink;display:none;"Id="Updatemealdiv"> "text"Id="txtname"Name="txtname"/>"text"Id="txtcomment"Name="txtcomment"/>"Button"Value="Update Meal"Id="Btnupdatemeal"Name="Btn
Jsformat:Download this plugin package https://github.com/sprinng/JsFormat here and download the zip in the bottom corner of the oil.The plug-in package is placed in the Data\packages directory of the sublime installation directoryRe-open sublime to use JS format pluginHow to use:1. Shortcut key: ctrl+alt+f2, first use the shortcut key to open the command panel "CTRL + SHIFT + P", and then enter "Format:javascript" can use the format commandHtml-css-js prettify:1. Shortcut key: Ctrl+shift+p2. Ent
Jsformat:Download this plugin package https://github.com/jdc0589/JsFormat here and download the zip in the bottom corner of the oil.The plug-in package is placed in the Data\packages directory of the sublime installation directoryRe-open sublime to use JS format pluginHow to use:1. Shortcut key: ctrl+alt+f2, first use the shortcut key to open the command panel "CTRL + SHIFT + P", and then enter "Format:javascript" can use the format commandHtml-css-js prettify:1. Shortcut key: Ctrl+shift+p2. Ent
1, HTML processing is relatively simple, direct output can be.
General use $ ("Jb51div"). innerHTML, etc.
2, JSON format data call
Copy Code code as follows:
$.ajax ({
URL: "/trundle/rawcontentaction.getajaxcontent.act",
Data: "Param1=22",
DataType: "JSON",//The dataType here is the data format returned back
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.