Create a new json.jsp file: <\/strong><\/p>\n\n\n<%@ page language=\"java\" import=\"java.util.*\" pageEncoding=\"UTF-8\"%>\n<%\nrequest.setCharacterEncoding(\"UTF-8\");\/\/防止亂碼!\nString name = request.getParameter(\"name\");\nString address = request.getParameter(\"address\");\nString comment = request.getParameter(\"comment\");\nSystem.out.println(name + \" - \" +address + \" - \" +comment);\nout.println( \"{ name : '\" +name+ \"' , address : '\"+address+ \"' ,comment : '\"+comment+ \"' }\" );\n%> <\/pre>\n<\/div>\nNew xml.jsp file: <\/p>\n\n\n<%@ page language=\"java\" import=\"java.util.*\" pageEncoding=\"UTF-8\"%>\n<%\nrequest.setCharacterEncoding(\"UTF-8\");\/\/防止亂碼!\nString name = request.getParameter(\"xmlname\");\nString address = request.getParameter(\"xmladdress\");\nString comment = request.getParameter(\"xmlcomment\");\nSystem.out.println(name + \" - \" +address + \" - \" +comment);\nresponse.setContentType(\"text\/xml\");\/\/注意,由于你是以xml形式傳遞過(guò)來(lái)的,所以這里必須寫(xiě)。\nout.print(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\");\nout.print(\"\");\nout.print(\"\"+name+\"<\/name>\");\nout.print(\"\"+address+\"<\/address>\");\nout.print(\"\"+comment+\"<\/comment>\");\nout.print(\"<\/root>\");\n%> <\/pre>\n<\/div>\nCreate a new html.jsp file: \n<\/p>\n\n\n<%@ page language=\"java\" import=\"java.util.*\" pageEncoding=\"UTF-8\"%>\n<%\nrequest.setCharacterEncoding(\"UTF-8\");\/\/防止亂碼!\nString name = request.getParameter(\"htmlname\");\nString address = request.getParameter(\"htmladdress\");\nString comment = request.getParameter(\"htmlcomment\");\nSystem.out.println(name + \" - \" +address + \" - \" +comment);\nout.println( \"\"+name+\" \"+address+\" \"+comment+\"<\/div>\" );\n%> <\/pre>\n<\/div>\nThe above is the use of the jQuery form plug-in that the editor shared with you to process the JSON, XML, and HTML data returned by the server. I hope it will be helpful to everyone. \n<\/p>"} 国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂 Community Articles Topics Q&A Learn Course Programming Dictionary Tools Library Development tools Website Source Code PHP Libraries JS special effects Website Materials Extension plug-ins AI Tools Leisure Game Download Game Tutorials English 簡(jiǎn)體中文 English 繁體中文 日本語(yǔ) ??? Melayu Fran?ais Deutsch Login singup Home Web Front-end JS Tutorial Use of jQuery form plug-in to process JSON, XML, HTML data returned by the server_jquery Use of jQuery form plug-in to process JSON, XML, HTML data returned by the server_jquery WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB May 16, 2016 pm 03:17 PM Without further ado, I will just post the code for you. The specific code is as follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>jQuery form插件的使用--處理server返回的JSON, XML,HTML數(shù)據(jù)</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="jquery-1.3.1.js" type="text/javascript"></script> <script src="jquery.form.js" type="text/javascript"></script> <script type="text/javascript"> // json $(document).ready(function() { $('#myForm').ajaxForm({ // 聲明 服務(wù)器返回?cái)?shù)據(jù)的類型. dataType: 'json', success: processJson }); }); function processJson(data) { // 'data'是一個(gè)json對(duì)象,從服務(wù)器返回的. $('#jsonOut').html(data.name + " "+data.address + " "+data.comment); } // xml $(document).ready(function() { $('#xmlForm').ajaxForm({ // 聲明 服務(wù)器返回?cái)?shù)據(jù)的類型. dataType: 'xml', success: processXml }); }); function processXml(responseXML) { // 'responseXML' 是一個(gè)XML的文檔 ,從服務(wù)器返回的. var name = $('name', responseXML).text(); var address = $('address', responseXML).text(); var comment = $('comment', responseXML).text(); $('#xmlOut').html(name + " "+address + " "+comment); } // html $(document).ready(function() { $('#htmlForm').ajaxForm({ // 用服務(wù)器返回的數(shù)據(jù) 更新 id為 htmlcssrain 的內(nèi)容. target: '#htmlOut', success: function() { $('#htmlOut').fadeIn('slow'); } }); }); </script> </head> <body> <h3> Demo 8 : jQuery form插件的使用--處理server返回的JSON, XML,HTML數(shù)據(jù)</h3> <!-- demo1 json--> <h4>json方式返回</h4> <form id="myForm" action="json.jsp" method="post"> 名稱: <input type="text" name="name" id="name" /> <br/> 地址: <input type="text" name="address" id="address"/><br/> 自我介紹: <textarea name="comment" id="comment" ></textarea> <br/> <input type="submit" id="test" value="json方式返回" /> <br/> <div id="jsonOut" ></div> </form> <!-- demo2 xml--> <h4>xml方式返回</h4> <form id="xmlForm" action="xml.jsp" method="post"> 名稱: <input type="text" name="xmlname" id="xmlname" /> <br/> 地址: <input type="text" name="xmladdress" id="xmladdress"/><br/> 自我介紹: <textarea name="xmlcomment" id="xmlcomment" ></textarea> <br/> <input type="submit" id="xmltest" value="xml方式返回" /> <br/> <div id="xmlOut" ></div> </form> <!-- demo3 html--> <h4>html方式返回</h4> <form id="htmlForm" action="html.jsp" method="post"> 名稱: <input type="text" name="htmlname" id="htmlname" /> <br/> 地址: <input type="text" name="htmladdress" id="htmladdress"/><br/> 自我介紹: <textarea name="htmlcomment" id="htmlcomment" ></textarea> <br/> <input type="submit" id="htmltest" value="html方式返回" /> <br/> <div id="htmlOut" ></div> </form> </body> </html> Create a new json.jsp file: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("name"); String address = request.getParameter("address"); String comment = request.getParameter("comment"); System.out.println(name + " - " +address + " - " +comment); out.println( "{ name : '" +name+ "' , address : '"+address+ "' ,comment : '"+comment+ "' }" ); %> New xml.jsp file: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("xmlname"); String address = request.getParameter("xmladdress"); String comment = request.getParameter("xmlcomment"); System.out.println(name + " - " +address + " - " +comment); response.setContentType("text/xml");//注意,由于你是以xml形式傳遞過(guò)來(lái)的,所以這里必須寫(xiě)。 out.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); out.print("<root>"); out.print("<name>"+name+"</name>"); out.print("<address>"+address+"</address>"); out.print("<comment>"+comment+"</comment>"); out.print("</root>"); %> Create a new html.jsp file: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("htmlname"); String address = request.getParameter("htmladdress"); String comment = request.getParameter("htmlcomment"); System.out.println(name + " - " +address + " - " +comment); out.println( "<div style='background-color:#ffa; padding:20px'>"+name+" "+address+" "+comment+"</div>" ); %> The above is the use of the jQuery form plug-in that the editor shared with you to process the JSON, XML, and HTML data returned by the server. I hope it will be helpful to everyone. Statement of this Website The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn Hot AI Tools Undress AI Tool Undress images for free Undresser.AI Undress AI-powered app for creating realistic nude photos AI Clothes Remover Online AI tool for removing clothes from photos. Clothoff.io AI clothes remover Video Face Swap Swap faces in any video effortlessly with our completely free AI face swap tool! Show More Hot Article Guide: Stellar Blade Save File Location/Save File Lost/Not Saving 1 months ago By DDD Oguri Cap Build Guide | A Pretty Derby Musume 2 weeks ago By Jack chen Agnes Tachyon Build Guide | A Pretty Derby Musume 2 weeks ago By Jack chen Dune: Awakening - Advanced Planetologist Quest Walkthrough 4 weeks ago By Jack chen Date Everything: Dirk And Harper Relationship Guide 4 weeks ago By Jack chen Show More Hot Tools Notepad++7.3.1 Easy-to-use and free code editor SublimeText3 Chinese version Chinese version, very easy to use Zend Studio 13.0.1 Powerful PHP integrated development environment Dreamweaver CS6 Visual web development tools SublimeText3 Mac version God-level code editing software (SublimeText3) Show More Hot Topics Where is the login entrance for gmail email? 8639 17 Java Tutorial 1785 16 CakePHP Tutorial 1729 56 Laravel Tutorial 1581 29 PHP Tutorial 1445 31 Show More Related knowledge Java vs. JavaScript: Clearing Up the Confusion Jun 20, 2025 am 12:27 AM Java and JavaScript are different programming languages, each suitable for different application scenarios. Java is used for large enterprise and mobile application development, while JavaScript is mainly used for web page development. Javascript Comments: short explanation Jun 19, 2025 am 12:40 AM JavaScriptcommentsareessentialformaintaining,reading,andguidingcodeexecution.1)Single-linecommentsareusedforquickexplanations.2)Multi-linecommentsexplaincomplexlogicorprovidedetaileddocumentation.3)Inlinecommentsclarifyspecificpartsofcode.Bestpractic How to work with dates and times in js? Jul 01, 2025 am 01:27 AM The following points should be noted when processing dates and time in JavaScript: 1. There are many ways to create Date objects. It is recommended to use ISO format strings to ensure compatibility; 2. Get and set time information can be obtained and set methods, and note that the month starts from 0; 3. Manually formatting dates requires strings, and third-party libraries can also be used; 4. It is recommended to use libraries that support time zones, such as Luxon. Mastering these key points can effectively avoid common mistakes. Why should you place tags at the bottom of the ? Jul 02, 2025 am 01:22 AM PlacingtagsatthebottomofablogpostorwebpageservespracticalpurposesforSEO,userexperience,anddesign.1.IthelpswithSEObyallowingsearchenginestoaccesskeyword-relevanttagswithoutclutteringthemaincontent.2.Itimprovesuserexperiencebykeepingthefocusonthearticl JavaScript vs. Java: A Comprehensive Comparison for Developers Jun 20, 2025 am 12:21 AM JavaScriptispreferredforwebdevelopment,whileJavaisbetterforlarge-scalebackendsystemsandAndroidapps.1)JavaScriptexcelsincreatinginteractivewebexperienceswithitsdynamicnatureandDOMmanipulation.2)Javaoffersstrongtypingandobject-orientedfeatures,idealfor JavaScript: Exploring Data Types for Efficient Coding Jun 20, 2025 am 12:46 AM JavaScripthassevenfundamentaldatatypes:number,string,boolean,undefined,null,object,andsymbol.1)Numbersuseadouble-precisionformat,usefulforwidevaluerangesbutbecautiouswithfloating-pointarithmetic.2)Stringsareimmutable,useefficientconcatenationmethodsf What is event bubbling and capturing in the DOM? Jul 02, 2025 am 01:19 AM Event capture and bubble are two stages of event propagation in DOM. Capture is from the top layer to the target element, and bubble is from the target element to the top layer. 1. Event capture is implemented by setting the useCapture parameter of addEventListener to true; 2. Event bubble is the default behavior, useCapture is set to false or omitted; 3. Event propagation can be used to prevent event propagation; 4. Event bubbling supports event delegation to improve dynamic content processing efficiency; 5. Capture can be used to intercept events in advance, such as logging or error processing. Understanding these two phases helps to accurately control the timing and how JavaScript responds to user operations. What's the Difference Between Java and JavaScript? Jun 17, 2025 am 09:17 AM Java and JavaScript are different programming languages. 1.Java is a statically typed and compiled language, suitable for enterprise applications and large systems. 2. JavaScript is a dynamic type and interpreted language, mainly used for web interaction and front-end development. See all articles
\n<%@ page language=\"java\" import=\"java.util.*\" pageEncoding=\"UTF-8\"%>\n<%\nrequest.setCharacterEncoding(\"UTF-8\");\/\/防止亂碼!\nString name = request.getParameter(\"name\");\nString address = request.getParameter(\"address\");\nString comment = request.getParameter(\"comment\");\nSystem.out.println(name + \" - \" +address + \" - \" +comment);\nout.println( \"{ name : '\" +name+ \"' , address : '\"+address+ \"' ,comment : '\"+comment+ \"' }\" );\n%> <\/pre>\n<\/div>\nNew xml.jsp file: <\/p>\n\n\n<%@ page language=\"java\" import=\"java.util.*\" pageEncoding=\"UTF-8\"%>\n<%\nrequest.setCharacterEncoding(\"UTF-8\");\/\/防止亂碼!\nString name = request.getParameter(\"xmlname\");\nString address = request.getParameter(\"xmladdress\");\nString comment = request.getParameter(\"xmlcomment\");\nSystem.out.println(name + \" - \" +address + \" - \" +comment);\nresponse.setContentType(\"text\/xml\");\/\/注意,由于你是以xml形式傳遞過(guò)來(lái)的,所以這里必須寫(xiě)。\nout.print(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\");\nout.print(\"\");\nout.print(\"\"+name+\"<\/name>\");\nout.print(\"\"+address+\"<\/address>\");\nout.print(\"\"+comment+\"<\/comment>\");\nout.print(\"<\/root>\");\n%> <\/pre>\n<\/div>\nCreate a new html.jsp file: \n<\/p>\n\n\n<%@ page language=\"java\" import=\"java.util.*\" pageEncoding=\"UTF-8\"%>\n<%\nrequest.setCharacterEncoding(\"UTF-8\");\/\/防止亂碼!\nString name = request.getParameter(\"htmlname\");\nString address = request.getParameter(\"htmladdress\");\nString comment = request.getParameter(\"htmlcomment\");\nSystem.out.println(name + \" - \" +address + \" - \" +comment);\nout.println( \"\"+name+\" \"+address+\" \"+comment+\"<\/div>\" );\n%> <\/pre>\n<\/div>\nThe above is the use of the jQuery form plug-in that the editor shared with you to process the JSON, XML, and HTML data returned by the server. I hope it will be helpful to everyone. \n<\/p>"} 国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂 Community Articles Topics Q&A Learn Course Programming Dictionary Tools Library Development tools Website Source Code PHP Libraries JS special effects Website Materials Extension plug-ins AI Tools Leisure Game Download Game Tutorials English 簡(jiǎn)體中文 English 繁體中文 日本語(yǔ) ??? Melayu Fran?ais Deutsch Login singup Home Web Front-end JS Tutorial Use of jQuery form plug-in to process JSON, XML, HTML data returned by the server_jquery Use of jQuery form plug-in to process JSON, XML, HTML data returned by the server_jquery WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB May 16, 2016 pm 03:17 PM Without further ado, I will just post the code for you. The specific code is as follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>jQuery form插件的使用--處理server返回的JSON, XML,HTML數(shù)據(jù)</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="jquery-1.3.1.js" type="text/javascript"></script> <script src="jquery.form.js" type="text/javascript"></script> <script type="text/javascript"> // json $(document).ready(function() { $('#myForm').ajaxForm({ // 聲明 服務(wù)器返回?cái)?shù)據(jù)的類型. dataType: 'json', success: processJson }); }); function processJson(data) { // 'data'是一個(gè)json對(duì)象,從服務(wù)器返回的. $('#jsonOut').html(data.name + " "+data.address + " "+data.comment); } // xml $(document).ready(function() { $('#xmlForm').ajaxForm({ // 聲明 服務(wù)器返回?cái)?shù)據(jù)的類型. dataType: 'xml', success: processXml }); }); function processXml(responseXML) { // 'responseXML' 是一個(gè)XML的文檔 ,從服務(wù)器返回的. var name = $('name', responseXML).text(); var address = $('address', responseXML).text(); var comment = $('comment', responseXML).text(); $('#xmlOut').html(name + " "+address + " "+comment); } // html $(document).ready(function() { $('#htmlForm').ajaxForm({ // 用服務(wù)器返回的數(shù)據(jù) 更新 id為 htmlcssrain 的內(nèi)容. target: '#htmlOut', success: function() { $('#htmlOut').fadeIn('slow'); } }); }); </script> </head> <body> <h3> Demo 8 : jQuery form插件的使用--處理server返回的JSON, XML,HTML數(shù)據(jù)</h3> <!-- demo1 json--> <h4>json方式返回</h4> <form id="myForm" action="json.jsp" method="post"> 名稱: <input type="text" name="name" id="name" /> <br/> 地址: <input type="text" name="address" id="address"/><br/> 自我介紹: <textarea name="comment" id="comment" ></textarea> <br/> <input type="submit" id="test" value="json方式返回" /> <br/> <div id="jsonOut" ></div> </form> <!-- demo2 xml--> <h4>xml方式返回</h4> <form id="xmlForm" action="xml.jsp" method="post"> 名稱: <input type="text" name="xmlname" id="xmlname" /> <br/> 地址: <input type="text" name="xmladdress" id="xmladdress"/><br/> 自我介紹: <textarea name="xmlcomment" id="xmlcomment" ></textarea> <br/> <input type="submit" id="xmltest" value="xml方式返回" /> <br/> <div id="xmlOut" ></div> </form> <!-- demo3 html--> <h4>html方式返回</h4> <form id="htmlForm" action="html.jsp" method="post"> 名稱: <input type="text" name="htmlname" id="htmlname" /> <br/> 地址: <input type="text" name="htmladdress" id="htmladdress"/><br/> 自我介紹: <textarea name="htmlcomment" id="htmlcomment" ></textarea> <br/> <input type="submit" id="htmltest" value="html方式返回" /> <br/> <div id="htmlOut" ></div> </form> </body> </html> Create a new json.jsp file: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("name"); String address = request.getParameter("address"); String comment = request.getParameter("comment"); System.out.println(name + " - " +address + " - " +comment); out.println( "{ name : '" +name+ "' , address : '"+address+ "' ,comment : '"+comment+ "' }" ); %> New xml.jsp file: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("xmlname"); String address = request.getParameter("xmladdress"); String comment = request.getParameter("xmlcomment"); System.out.println(name + " - " +address + " - " +comment); response.setContentType("text/xml");//注意,由于你是以xml形式傳遞過(guò)來(lái)的,所以這里必須寫(xiě)。 out.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); out.print("<root>"); out.print("<name>"+name+"</name>"); out.print("<address>"+address+"</address>"); out.print("<comment>"+comment+"</comment>"); out.print("</root>"); %> Create a new html.jsp file: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("htmlname"); String address = request.getParameter("htmladdress"); String comment = request.getParameter("htmlcomment"); System.out.println(name + " - " +address + " - " +comment); out.println( "<div style='background-color:#ffa; padding:20px'>"+name+" "+address+" "+comment+"</div>" ); %> The above is the use of the jQuery form plug-in that the editor shared with you to process the JSON, XML, and HTML data returned by the server. I hope it will be helpful to everyone. Statement of this Website The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn Hot AI Tools Undress AI Tool Undress images for free Undresser.AI Undress AI-powered app for creating realistic nude photos AI Clothes Remover Online AI tool for removing clothes from photos. Clothoff.io AI clothes remover Video Face Swap Swap faces in any video effortlessly with our completely free AI face swap tool! Show More Hot Article Guide: Stellar Blade Save File Location/Save File Lost/Not Saving 1 months ago By DDD Oguri Cap Build Guide | A Pretty Derby Musume 2 weeks ago By Jack chen Agnes Tachyon Build Guide | A Pretty Derby Musume 2 weeks ago By Jack chen Dune: Awakening - Advanced Planetologist Quest Walkthrough 4 weeks ago By Jack chen Date Everything: Dirk And Harper Relationship Guide 4 weeks ago By Jack chen Show More Hot Tools Notepad++7.3.1 Easy-to-use and free code editor SublimeText3 Chinese version Chinese version, very easy to use Zend Studio 13.0.1 Powerful PHP integrated development environment Dreamweaver CS6 Visual web development tools SublimeText3 Mac version God-level code editing software (SublimeText3) Show More Hot Topics Where is the login entrance for gmail email? 8639 17 Java Tutorial 1785 16 CakePHP Tutorial 1729 56 Laravel Tutorial 1581 29 PHP Tutorial 1445 31 Show More Related knowledge Java vs. JavaScript: Clearing Up the Confusion Jun 20, 2025 am 12:27 AM Java and JavaScript are different programming languages, each suitable for different application scenarios. Java is used for large enterprise and mobile application development, while JavaScript is mainly used for web page development. Javascript Comments: short explanation Jun 19, 2025 am 12:40 AM JavaScriptcommentsareessentialformaintaining,reading,andguidingcodeexecution.1)Single-linecommentsareusedforquickexplanations.2)Multi-linecommentsexplaincomplexlogicorprovidedetaileddocumentation.3)Inlinecommentsclarifyspecificpartsofcode.Bestpractic How to work with dates and times in js? Jul 01, 2025 am 01:27 AM The following points should be noted when processing dates and time in JavaScript: 1. There are many ways to create Date objects. It is recommended to use ISO format strings to ensure compatibility; 2. Get and set time information can be obtained and set methods, and note that the month starts from 0; 3. Manually formatting dates requires strings, and third-party libraries can also be used; 4. It is recommended to use libraries that support time zones, such as Luxon. Mastering these key points can effectively avoid common mistakes. Why should you place tags at the bottom of the ? Jul 02, 2025 am 01:22 AM PlacingtagsatthebottomofablogpostorwebpageservespracticalpurposesforSEO,userexperience,anddesign.1.IthelpswithSEObyallowingsearchenginestoaccesskeyword-relevanttagswithoutclutteringthemaincontent.2.Itimprovesuserexperiencebykeepingthefocusonthearticl JavaScript vs. Java: A Comprehensive Comparison for Developers Jun 20, 2025 am 12:21 AM JavaScriptispreferredforwebdevelopment,whileJavaisbetterforlarge-scalebackendsystemsandAndroidapps.1)JavaScriptexcelsincreatinginteractivewebexperienceswithitsdynamicnatureandDOMmanipulation.2)Javaoffersstrongtypingandobject-orientedfeatures,idealfor JavaScript: Exploring Data Types for Efficient Coding Jun 20, 2025 am 12:46 AM JavaScripthassevenfundamentaldatatypes:number,string,boolean,undefined,null,object,andsymbol.1)Numbersuseadouble-precisionformat,usefulforwidevaluerangesbutbecautiouswithfloating-pointarithmetic.2)Stringsareimmutable,useefficientconcatenationmethodsf What is event bubbling and capturing in the DOM? Jul 02, 2025 am 01:19 AM Event capture and bubble are two stages of event propagation in DOM. Capture is from the top layer to the target element, and bubble is from the target element to the top layer. 1. Event capture is implemented by setting the useCapture parameter of addEventListener to true; 2. Event bubble is the default behavior, useCapture is set to false or omitted; 3. Event propagation can be used to prevent event propagation; 4. Event bubbling supports event delegation to improve dynamic content processing efficiency; 5. Capture can be used to intercept events in advance, such as logging or error processing. Understanding these two phases helps to accurately control the timing and how JavaScript responds to user operations. What's the Difference Between Java and JavaScript? Jun 17, 2025 am 09:17 AM Java and JavaScript are different programming languages. 1.Java is a statically typed and compiled language, suitable for enterprise applications and large systems. 2. JavaScript is a dynamic type and interpreted language, mainly used for web interaction and front-end development. See all articles
New xml.jsp file: <\/p>\n
\n<%@ page language=\"java\" import=\"java.util.*\" pageEncoding=\"UTF-8\"%>\n<%\nrequest.setCharacterEncoding(\"UTF-8\");\/\/防止亂碼!\nString name = request.getParameter(\"xmlname\");\nString address = request.getParameter(\"xmladdress\");\nString comment = request.getParameter(\"xmlcomment\");\nSystem.out.println(name + \" - \" +address + \" - \" +comment);\nresponse.setContentType(\"text\/xml\");\/\/注意,由于你是以xml形式傳遞過(guò)來(lái)的,所以這里必須寫(xiě)。\nout.print(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\");\nout.print(\"\");\nout.print(\"\"+name+\"<\/name>\");\nout.print(\"\"+address+\"<\/address>\");\nout.print(\"\"+comment+\"<\/comment>\");\nout.print(\"<\/root>\");\n%> <\/pre>\n<\/div>\nCreate a new html.jsp file: \n<\/p>\n\n\n<%@ page language=\"java\" import=\"java.util.*\" pageEncoding=\"UTF-8\"%>\n<%\nrequest.setCharacterEncoding(\"UTF-8\");\/\/防止亂碼!\nString name = request.getParameter(\"htmlname\");\nString address = request.getParameter(\"htmladdress\");\nString comment = request.getParameter(\"htmlcomment\");\nSystem.out.println(name + \" - \" +address + \" - \" +comment);\nout.println( \"\"+name+\" \"+address+\" \"+comment+\"<\/div>\" );\n%> <\/pre>\n<\/div>\nThe above is the use of the jQuery form plug-in that the editor shared with you to process the JSON, XML, and HTML data returned by the server. I hope it will be helpful to everyone. \n<\/p>"} 国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂 Community Articles Topics Q&A Learn Course Programming Dictionary Tools Library Development tools Website Source Code PHP Libraries JS special effects Website Materials Extension plug-ins AI Tools Leisure Game Download Game Tutorials English 簡(jiǎn)體中文 English 繁體中文 日本語(yǔ) ??? Melayu Fran?ais Deutsch Login singup Home Web Front-end JS Tutorial Use of jQuery form plug-in to process JSON, XML, HTML data returned by the server_jquery Use of jQuery form plug-in to process JSON, XML, HTML data returned by the server_jquery WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB May 16, 2016 pm 03:17 PM Without further ado, I will just post the code for you. The specific code is as follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>jQuery form插件的使用--處理server返回的JSON, XML,HTML數(shù)據(jù)</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="jquery-1.3.1.js" type="text/javascript"></script> <script src="jquery.form.js" type="text/javascript"></script> <script type="text/javascript"> // json $(document).ready(function() { $('#myForm').ajaxForm({ // 聲明 服務(wù)器返回?cái)?shù)據(jù)的類型. dataType: 'json', success: processJson }); }); function processJson(data) { // 'data'是一個(gè)json對(duì)象,從服務(wù)器返回的. $('#jsonOut').html(data.name + " "+data.address + " "+data.comment); } // xml $(document).ready(function() { $('#xmlForm').ajaxForm({ // 聲明 服務(wù)器返回?cái)?shù)據(jù)的類型. dataType: 'xml', success: processXml }); }); function processXml(responseXML) { // 'responseXML' 是一個(gè)XML的文檔 ,從服務(wù)器返回的. var name = $('name', responseXML).text(); var address = $('address', responseXML).text(); var comment = $('comment', responseXML).text(); $('#xmlOut').html(name + " "+address + " "+comment); } // html $(document).ready(function() { $('#htmlForm').ajaxForm({ // 用服務(wù)器返回的數(shù)據(jù) 更新 id為 htmlcssrain 的內(nèi)容. target: '#htmlOut', success: function() { $('#htmlOut').fadeIn('slow'); } }); }); </script> </head> <body> <h3> Demo 8 : jQuery form插件的使用--處理server返回的JSON, XML,HTML數(shù)據(jù)</h3> <!-- demo1 json--> <h4>json方式返回</h4> <form id="myForm" action="json.jsp" method="post"> 名稱: <input type="text" name="name" id="name" /> <br/> 地址: <input type="text" name="address" id="address"/><br/> 自我介紹: <textarea name="comment" id="comment" ></textarea> <br/> <input type="submit" id="test" value="json方式返回" /> <br/> <div id="jsonOut" ></div> </form> <!-- demo2 xml--> <h4>xml方式返回</h4> <form id="xmlForm" action="xml.jsp" method="post"> 名稱: <input type="text" name="xmlname" id="xmlname" /> <br/> 地址: <input type="text" name="xmladdress" id="xmladdress"/><br/> 自我介紹: <textarea name="xmlcomment" id="xmlcomment" ></textarea> <br/> <input type="submit" id="xmltest" value="xml方式返回" /> <br/> <div id="xmlOut" ></div> </form> <!-- demo3 html--> <h4>html方式返回</h4> <form id="htmlForm" action="html.jsp" method="post"> 名稱: <input type="text" name="htmlname" id="htmlname" /> <br/> 地址: <input type="text" name="htmladdress" id="htmladdress"/><br/> 自我介紹: <textarea name="htmlcomment" id="htmlcomment" ></textarea> <br/> <input type="submit" id="htmltest" value="html方式返回" /> <br/> <div id="htmlOut" ></div> </form> </body> </html> Create a new json.jsp file: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("name"); String address = request.getParameter("address"); String comment = request.getParameter("comment"); System.out.println(name + " - " +address + " - " +comment); out.println( "{ name : '" +name+ "' , address : '"+address+ "' ,comment : '"+comment+ "' }" ); %> New xml.jsp file: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("xmlname"); String address = request.getParameter("xmladdress"); String comment = request.getParameter("xmlcomment"); System.out.println(name + " - " +address + " - " +comment); response.setContentType("text/xml");//注意,由于你是以xml形式傳遞過(guò)來(lái)的,所以這里必須寫(xiě)。 out.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); out.print("<root>"); out.print("<name>"+name+"</name>"); out.print("<address>"+address+"</address>"); out.print("<comment>"+comment+"</comment>"); out.print("</root>"); %> Create a new html.jsp file: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("htmlname"); String address = request.getParameter("htmladdress"); String comment = request.getParameter("htmlcomment"); System.out.println(name + " - " +address + " - " +comment); out.println( "<div style='background-color:#ffa; padding:20px'>"+name+" "+address+" "+comment+"</div>" ); %> The above is the use of the jQuery form plug-in that the editor shared with you to process the JSON, XML, and HTML data returned by the server. I hope it will be helpful to everyone. Statement of this Website The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn Hot AI Tools Undress AI Tool Undress images for free Undresser.AI Undress AI-powered app for creating realistic nude photos AI Clothes Remover Online AI tool for removing clothes from photos. Clothoff.io AI clothes remover Video Face Swap Swap faces in any video effortlessly with our completely free AI face swap tool! Show More Hot Article Guide: Stellar Blade Save File Location/Save File Lost/Not Saving 1 months ago By DDD Oguri Cap Build Guide | A Pretty Derby Musume 2 weeks ago By Jack chen Agnes Tachyon Build Guide | A Pretty Derby Musume 2 weeks ago By Jack chen Dune: Awakening - Advanced Planetologist Quest Walkthrough 4 weeks ago By Jack chen Date Everything: Dirk And Harper Relationship Guide 4 weeks ago By Jack chen Show More Hot Tools Notepad++7.3.1 Easy-to-use and free code editor SublimeText3 Chinese version Chinese version, very easy to use Zend Studio 13.0.1 Powerful PHP integrated development environment Dreamweaver CS6 Visual web development tools SublimeText3 Mac version God-level code editing software (SublimeText3) Show More Hot Topics Where is the login entrance for gmail email? 8639 17 Java Tutorial 1785 16 CakePHP Tutorial 1729 56 Laravel Tutorial 1581 29 PHP Tutorial 1445 31 Show More Related knowledge Java vs. JavaScript: Clearing Up the Confusion Jun 20, 2025 am 12:27 AM Java and JavaScript are different programming languages, each suitable for different application scenarios. Java is used for large enterprise and mobile application development, while JavaScript is mainly used for web page development. Javascript Comments: short explanation Jun 19, 2025 am 12:40 AM JavaScriptcommentsareessentialformaintaining,reading,andguidingcodeexecution.1)Single-linecommentsareusedforquickexplanations.2)Multi-linecommentsexplaincomplexlogicorprovidedetaileddocumentation.3)Inlinecommentsclarifyspecificpartsofcode.Bestpractic How to work with dates and times in js? Jul 01, 2025 am 01:27 AM The following points should be noted when processing dates and time in JavaScript: 1. There are many ways to create Date objects. It is recommended to use ISO format strings to ensure compatibility; 2. Get and set time information can be obtained and set methods, and note that the month starts from 0; 3. Manually formatting dates requires strings, and third-party libraries can also be used; 4. It is recommended to use libraries that support time zones, such as Luxon. Mastering these key points can effectively avoid common mistakes. Why should you place tags at the bottom of the ? Jul 02, 2025 am 01:22 AM PlacingtagsatthebottomofablogpostorwebpageservespracticalpurposesforSEO,userexperience,anddesign.1.IthelpswithSEObyallowingsearchenginestoaccesskeyword-relevanttagswithoutclutteringthemaincontent.2.Itimprovesuserexperiencebykeepingthefocusonthearticl JavaScript vs. Java: A Comprehensive Comparison for Developers Jun 20, 2025 am 12:21 AM JavaScriptispreferredforwebdevelopment,whileJavaisbetterforlarge-scalebackendsystemsandAndroidapps.1)JavaScriptexcelsincreatinginteractivewebexperienceswithitsdynamicnatureandDOMmanipulation.2)Javaoffersstrongtypingandobject-orientedfeatures,idealfor JavaScript: Exploring Data Types for Efficient Coding Jun 20, 2025 am 12:46 AM JavaScripthassevenfundamentaldatatypes:number,string,boolean,undefined,null,object,andsymbol.1)Numbersuseadouble-precisionformat,usefulforwidevaluerangesbutbecautiouswithfloating-pointarithmetic.2)Stringsareimmutable,useefficientconcatenationmethodsf What is event bubbling and capturing in the DOM? Jul 02, 2025 am 01:19 AM Event capture and bubble are two stages of event propagation in DOM. Capture is from the top layer to the target element, and bubble is from the target element to the top layer. 1. Event capture is implemented by setting the useCapture parameter of addEventListener to true; 2. Event bubble is the default behavior, useCapture is set to false or omitted; 3. Event propagation can be used to prevent event propagation; 4. Event bubbling supports event delegation to improve dynamic content processing efficiency; 5. Capture can be used to intercept events in advance, such as logging or error processing. Understanding these two phases helps to accurately control the timing and how JavaScript responds to user operations. What's the Difference Between Java and JavaScript? Jun 17, 2025 am 09:17 AM Java and JavaScript are different programming languages. 1.Java is a statically typed and compiled language, suitable for enterprise applications and large systems. 2. JavaScript is a dynamic type and interpreted language, mainly used for web interaction and front-end development. See all articles
Create a new html.jsp file: \n<\/p>\n
\n<%@ page language=\"java\" import=\"java.util.*\" pageEncoding=\"UTF-8\"%>\n<%\nrequest.setCharacterEncoding(\"UTF-8\");\/\/防止亂碼!\nString name = request.getParameter(\"htmlname\");\nString address = request.getParameter(\"htmladdress\");\nString comment = request.getParameter(\"htmlcomment\");\nSystem.out.println(name + \" - \" +address + \" - \" +comment);\nout.println( \"\"+name+\" \"+address+\" \"+comment+\"<\/div>\" );\n%> <\/pre>\n<\/div>\nThe above is the use of the jQuery form plug-in that the editor shared with you to process the JSON, XML, and HTML data returned by the server. I hope it will be helpful to everyone. \n<\/p>"} 国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂 Community Articles Topics Q&A Learn Course Programming Dictionary Tools Library Development tools Website Source Code PHP Libraries JS special effects Website Materials Extension plug-ins AI Tools Leisure Game Download Game Tutorials English 簡(jiǎn)體中文 English 繁體中文 日本語(yǔ) ??? Melayu Fran?ais Deutsch Login singup Home Web Front-end JS Tutorial Use of jQuery form plug-in to process JSON, XML, HTML data returned by the server_jquery Use of jQuery form plug-in to process JSON, XML, HTML data returned by the server_jquery WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB May 16, 2016 pm 03:17 PM Without further ado, I will just post the code for you. The specific code is as follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>jQuery form插件的使用--處理server返回的JSON, XML,HTML數(shù)據(jù)</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="jquery-1.3.1.js" type="text/javascript"></script> <script src="jquery.form.js" type="text/javascript"></script> <script type="text/javascript"> // json $(document).ready(function() { $('#myForm').ajaxForm({ // 聲明 服務(wù)器返回?cái)?shù)據(jù)的類型. dataType: 'json', success: processJson }); }); function processJson(data) { // 'data'是一個(gè)json對(duì)象,從服務(wù)器返回的. $('#jsonOut').html(data.name + " "+data.address + " "+data.comment); } // xml $(document).ready(function() { $('#xmlForm').ajaxForm({ // 聲明 服務(wù)器返回?cái)?shù)據(jù)的類型. dataType: 'xml', success: processXml }); }); function processXml(responseXML) { // 'responseXML' 是一個(gè)XML的文檔 ,從服務(wù)器返回的. var name = $('name', responseXML).text(); var address = $('address', responseXML).text(); var comment = $('comment', responseXML).text(); $('#xmlOut').html(name + " "+address + " "+comment); } // html $(document).ready(function() { $('#htmlForm').ajaxForm({ // 用服務(wù)器返回的數(shù)據(jù) 更新 id為 htmlcssrain 的內(nèi)容. target: '#htmlOut', success: function() { $('#htmlOut').fadeIn('slow'); } }); }); </script> </head> <body> <h3> Demo 8 : jQuery form插件的使用--處理server返回的JSON, XML,HTML數(shù)據(jù)</h3> <!-- demo1 json--> <h4>json方式返回</h4> <form id="myForm" action="json.jsp" method="post"> 名稱: <input type="text" name="name" id="name" /> <br/> 地址: <input type="text" name="address" id="address"/><br/> 自我介紹: <textarea name="comment" id="comment" ></textarea> <br/> <input type="submit" id="test" value="json方式返回" /> <br/> <div id="jsonOut" ></div> </form> <!-- demo2 xml--> <h4>xml方式返回</h4> <form id="xmlForm" action="xml.jsp" method="post"> 名稱: <input type="text" name="xmlname" id="xmlname" /> <br/> 地址: <input type="text" name="xmladdress" id="xmladdress"/><br/> 自我介紹: <textarea name="xmlcomment" id="xmlcomment" ></textarea> <br/> <input type="submit" id="xmltest" value="xml方式返回" /> <br/> <div id="xmlOut" ></div> </form> <!-- demo3 html--> <h4>html方式返回</h4> <form id="htmlForm" action="html.jsp" method="post"> 名稱: <input type="text" name="htmlname" id="htmlname" /> <br/> 地址: <input type="text" name="htmladdress" id="htmladdress"/><br/> 自我介紹: <textarea name="htmlcomment" id="htmlcomment" ></textarea> <br/> <input type="submit" id="htmltest" value="html方式返回" /> <br/> <div id="htmlOut" ></div> </form> </body> </html> Create a new json.jsp file: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("name"); String address = request.getParameter("address"); String comment = request.getParameter("comment"); System.out.println(name + " - " +address + " - " +comment); out.println( "{ name : '" +name+ "' , address : '"+address+ "' ,comment : '"+comment+ "' }" ); %> New xml.jsp file: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("xmlname"); String address = request.getParameter("xmladdress"); String comment = request.getParameter("xmlcomment"); System.out.println(name + " - " +address + " - " +comment); response.setContentType("text/xml");//注意,由于你是以xml形式傳遞過(guò)來(lái)的,所以這里必須寫(xiě)。 out.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); out.print("<root>"); out.print("<name>"+name+"</name>"); out.print("<address>"+address+"</address>"); out.print("<comment>"+comment+"</comment>"); out.print("</root>"); %> Create a new html.jsp file: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("htmlname"); String address = request.getParameter("htmladdress"); String comment = request.getParameter("htmlcomment"); System.out.println(name + " - " +address + " - " +comment); out.println( "<div style='background-color:#ffa; padding:20px'>"+name+" "+address+" "+comment+"</div>" ); %> The above is the use of the jQuery form plug-in that the editor shared with you to process the JSON, XML, and HTML data returned by the server. I hope it will be helpful to everyone. Statement of this Website The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn Hot AI Tools Undress AI Tool Undress images for free Undresser.AI Undress AI-powered app for creating realistic nude photos AI Clothes Remover Online AI tool for removing clothes from photos. Clothoff.io AI clothes remover Video Face Swap Swap faces in any video effortlessly with our completely free AI face swap tool! Show More Hot Article Guide: Stellar Blade Save File Location/Save File Lost/Not Saving 1 months ago By DDD Oguri Cap Build Guide | A Pretty Derby Musume 2 weeks ago By Jack chen Agnes Tachyon Build Guide | A Pretty Derby Musume 2 weeks ago By Jack chen Dune: Awakening - Advanced Planetologist Quest Walkthrough 4 weeks ago By Jack chen Date Everything: Dirk And Harper Relationship Guide 4 weeks ago By Jack chen Show More Hot Tools Notepad++7.3.1 Easy-to-use and free code editor SublimeText3 Chinese version Chinese version, very easy to use Zend Studio 13.0.1 Powerful PHP integrated development environment Dreamweaver CS6 Visual web development tools SublimeText3 Mac version God-level code editing software (SublimeText3) Show More Hot Topics Where is the login entrance for gmail email? 8639 17 Java Tutorial 1785 16 CakePHP Tutorial 1729 56 Laravel Tutorial 1581 29 PHP Tutorial 1445 31 Show More Related knowledge Java vs. JavaScript: Clearing Up the Confusion Jun 20, 2025 am 12:27 AM Java and JavaScript are different programming languages, each suitable for different application scenarios. Java is used for large enterprise and mobile application development, while JavaScript is mainly used for web page development. Javascript Comments: short explanation Jun 19, 2025 am 12:40 AM JavaScriptcommentsareessentialformaintaining,reading,andguidingcodeexecution.1)Single-linecommentsareusedforquickexplanations.2)Multi-linecommentsexplaincomplexlogicorprovidedetaileddocumentation.3)Inlinecommentsclarifyspecificpartsofcode.Bestpractic How to work with dates and times in js? Jul 01, 2025 am 01:27 AM The following points should be noted when processing dates and time in JavaScript: 1. There are many ways to create Date objects. It is recommended to use ISO format strings to ensure compatibility; 2. Get and set time information can be obtained and set methods, and note that the month starts from 0; 3. Manually formatting dates requires strings, and third-party libraries can also be used; 4. It is recommended to use libraries that support time zones, such as Luxon. Mastering these key points can effectively avoid common mistakes. Why should you place tags at the bottom of the ? Jul 02, 2025 am 01:22 AM PlacingtagsatthebottomofablogpostorwebpageservespracticalpurposesforSEO,userexperience,anddesign.1.IthelpswithSEObyallowingsearchenginestoaccesskeyword-relevanttagswithoutclutteringthemaincontent.2.Itimprovesuserexperiencebykeepingthefocusonthearticl JavaScript vs. Java: A Comprehensive Comparison for Developers Jun 20, 2025 am 12:21 AM JavaScriptispreferredforwebdevelopment,whileJavaisbetterforlarge-scalebackendsystemsandAndroidapps.1)JavaScriptexcelsincreatinginteractivewebexperienceswithitsdynamicnatureandDOMmanipulation.2)Javaoffersstrongtypingandobject-orientedfeatures,idealfor JavaScript: Exploring Data Types for Efficient Coding Jun 20, 2025 am 12:46 AM JavaScripthassevenfundamentaldatatypes:number,string,boolean,undefined,null,object,andsymbol.1)Numbersuseadouble-precisionformat,usefulforwidevaluerangesbutbecautiouswithfloating-pointarithmetic.2)Stringsareimmutable,useefficientconcatenationmethodsf What is event bubbling and capturing in the DOM? Jul 02, 2025 am 01:19 AM Event capture and bubble are two stages of event propagation in DOM. Capture is from the top layer to the target element, and bubble is from the target element to the top layer. 1. Event capture is implemented by setting the useCapture parameter of addEventListener to true; 2. Event bubble is the default behavior, useCapture is set to false or omitted; 3. Event propagation can be used to prevent event propagation; 4. Event bubbling supports event delegation to improve dynamic content processing efficiency; 5. Capture can be used to intercept events in advance, such as logging or error processing. Understanding these two phases helps to accurately control the timing and how JavaScript responds to user operations. What's the Difference Between Java and JavaScript? Jun 17, 2025 am 09:17 AM Java and JavaScript are different programming languages. 1.Java is a statically typed and compiled language, suitable for enterprise applications and large systems. 2. JavaScript is a dynamic type and interpreted language, mainly used for web interaction and front-end development. See all articles
The above is the use of the jQuery form plug-in that the editor shared with you to process the JSON, XML, and HTML data returned by the server. I hope it will be helpful to everyone. \n<\/p>"}
Without further ado, I will just post the code for you. The specific code is as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>jQuery form插件的使用--處理server返回的JSON, XML,HTML數(shù)據(jù)</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="jquery-1.3.1.js" type="text/javascript"></script> <script src="jquery.form.js" type="text/javascript"></script> <script type="text/javascript"> // json $(document).ready(function() { $('#myForm').ajaxForm({ // 聲明 服務(wù)器返回?cái)?shù)據(jù)的類型. dataType: 'json', success: processJson }); }); function processJson(data) { // 'data'是一個(gè)json對(duì)象,從服務(wù)器返回的. $('#jsonOut').html(data.name + " "+data.address + " "+data.comment); } // xml $(document).ready(function() { $('#xmlForm').ajaxForm({ // 聲明 服務(wù)器返回?cái)?shù)據(jù)的類型. dataType: 'xml', success: processXml }); }); function processXml(responseXML) { // 'responseXML' 是一個(gè)XML的文檔 ,從服務(wù)器返回的. var name = $('name', responseXML).text(); var address = $('address', responseXML).text(); var comment = $('comment', responseXML).text(); $('#xmlOut').html(name + " "+address + " "+comment); } // html $(document).ready(function() { $('#htmlForm').ajaxForm({ // 用服務(wù)器返回的數(shù)據(jù) 更新 id為 htmlcssrain 的內(nèi)容. target: '#htmlOut', success: function() { $('#htmlOut').fadeIn('slow'); } }); }); </script> </head> <body> <h3> Demo 8 : jQuery form插件的使用--處理server返回的JSON, XML,HTML數(shù)據(jù)</h3> <!-- demo1 json--> <h4>json方式返回</h4> <form id="myForm" action="json.jsp" method="post"> 名稱: <input type="text" name="name" id="name" /> <br/> 地址: <input type="text" name="address" id="address"/><br/> 自我介紹: <textarea name="comment" id="comment" ></textarea> <br/> <input type="submit" id="test" value="json方式返回" /> <br/> <div id="jsonOut" ></div> </form> <!-- demo2 xml--> <h4>xml方式返回</h4> <form id="xmlForm" action="xml.jsp" method="post"> 名稱: <input type="text" name="xmlname" id="xmlname" /> <br/> 地址: <input type="text" name="xmladdress" id="xmladdress"/><br/> 自我介紹: <textarea name="xmlcomment" id="xmlcomment" ></textarea> <br/> <input type="submit" id="xmltest" value="xml方式返回" /> <br/> <div id="xmlOut" ></div> </form> <!-- demo3 html--> <h4>html方式返回</h4> <form id="htmlForm" action="html.jsp" method="post"> 名稱: <input type="text" name="htmlname" id="htmlname" /> <br/> 地址: <input type="text" name="htmladdress" id="htmladdress"/><br/> 自我介紹: <textarea name="htmlcomment" id="htmlcomment" ></textarea> <br/> <input type="submit" id="htmltest" value="html方式返回" /> <br/> <div id="htmlOut" ></div> </form> </body> </html>
Create a new json.jsp file:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("name"); String address = request.getParameter("address"); String comment = request.getParameter("comment"); System.out.println(name + " - " +address + " - " +comment); out.println( "{ name : '" +name+ "' , address : '"+address+ "' ,comment : '"+comment+ "' }" ); %>
New xml.jsp file:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("xmlname"); String address = request.getParameter("xmladdress"); String comment = request.getParameter("xmlcomment"); System.out.println(name + " - " +address + " - " +comment); response.setContentType("text/xml");//注意,由于你是以xml形式傳遞過(guò)來(lái)的,所以這里必須寫(xiě)。 out.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); out.print("<root>"); out.print("<name>"+name+"</name>"); out.print("<address>"+address+"</address>"); out.print("<comment>"+comment+"</comment>"); out.print("</root>"); %>
Create a new html.jsp file:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("UTF-8");//防止亂碼! String name = request.getParameter("htmlname"); String address = request.getParameter("htmladdress"); String comment = request.getParameter("htmlcomment"); System.out.println(name + " - " +address + " - " +comment); out.println( "<div style='background-color:#ffa; padding:20px'>"+name+" "+address+" "+comment+"</div>" ); %>
The above is the use of the jQuery form plug-in that the editor shared with you to process the JSON, XML, and HTML data returned by the server. I hope it will be helpful to everyone.
Undress images for free
AI-powered app for creating realistic nude photos
Online AI tool for removing clothes from photos.
AI clothes remover
Swap faces in any video effortlessly with our completely free AI face swap tool!
Easy-to-use and free code editor
Chinese version, very easy to use
Powerful PHP integrated development environment
Visual web development tools
God-level code editing software (SublimeText3)
Java and JavaScript are different programming languages, each suitable for different application scenarios. Java is used for large enterprise and mobile application development, while JavaScript is mainly used for web page development.
JavaScriptcommentsareessentialformaintaining,reading,andguidingcodeexecution.1)Single-linecommentsareusedforquickexplanations.2)Multi-linecommentsexplaincomplexlogicorprovidedetaileddocumentation.3)Inlinecommentsclarifyspecificpartsofcode.Bestpractic
The following points should be noted when processing dates and time in JavaScript: 1. There are many ways to create Date objects. It is recommended to use ISO format strings to ensure compatibility; 2. Get and set time information can be obtained and set methods, and note that the month starts from 0; 3. Manually formatting dates requires strings, and third-party libraries can also be used; 4. It is recommended to use libraries that support time zones, such as Luxon. Mastering these key points can effectively avoid common mistakes.
PlacingtagsatthebottomofablogpostorwebpageservespracticalpurposesforSEO,userexperience,anddesign.1.IthelpswithSEObyallowingsearchenginestoaccesskeyword-relevanttagswithoutclutteringthemaincontent.2.Itimprovesuserexperiencebykeepingthefocusonthearticl
JavaScriptispreferredforwebdevelopment,whileJavaisbetterforlarge-scalebackendsystemsandAndroidapps.1)JavaScriptexcelsincreatinginteractivewebexperienceswithitsdynamicnatureandDOMmanipulation.2)Javaoffersstrongtypingandobject-orientedfeatures,idealfor
JavaScripthassevenfundamentaldatatypes:number,string,boolean,undefined,null,object,andsymbol.1)Numbersuseadouble-precisionformat,usefulforwidevaluerangesbutbecautiouswithfloating-pointarithmetic.2)Stringsareimmutable,useefficientconcatenationmethodsf
Event capture and bubble are two stages of event propagation in DOM. Capture is from the top layer to the target element, and bubble is from the target element to the top layer. 1. Event capture is implemented by setting the useCapture parameter of addEventListener to true; 2. Event bubble is the default behavior, useCapture is set to false or omitted; 3. Event propagation can be used to prevent event propagation; 4. Event bubbling supports event delegation to improve dynamic content processing efficiency; 5. Capture can be used to intercept events in advance, such as logging or error processing. Understanding these two phases helps to accurately control the timing and how JavaScript responds to user operations.
Java and JavaScript are different programming languages. 1.Java is a statically typed and compiled language, suitable for enterprise applications and large systems. 2. JavaScript is a dynamic type and interpreted language, mainly used for web interaction and front-end development.