Recently made a Spring+ajax two Cascade menu, always reported a variety of errors, and finally through the analysis and summary finally solve the problem, now the problem to show everyone, for sharing. If you have questions to comment on, definitely
First download the Ext-basex script file from http://code.google.com/p/ext-basex/, after decompression, according to the instructions Readme file to refer to the EXT library and Ext-basex.
Then use the Ext.Ajax.request method to add
Always enjoy using native JavaScript, especially if you don't need to consider compatibility scenarios (albeit pitifully). Unfortunately ECMAScript does not encapsulate a good Ajax method (in fact, there is no need to have), the use of their own
Asynchronously saves data through jquery. Ajax functions
Practical Examples:
In _form.html.erb:
" data-id= ' ' >
The data that is accepted by input is saved, and the Data-id custom property means that the value of the f.id is saved so that
First page;
function Gethttpobject (){var waystation=null;if (window. ActiveXObject){Waystation=new ActiveXObject ("Microsoft.XMLHTTP");}else if (window. XMLHttpRequest){Waystation=new XMLHttpRequest ();}Else{Waystation=false;}return
Do a file upload module, because the traditional form submission will have a page refresh, does not conform to my use requirements, so I use the Ajax submission method, here is explained, my application front end for Ajax submission, backend
File one: Front-end template file news.html.
Used to nest PHP statements after loading the database content to produce news.htmls static files.
Articles Home
Data used with Ajax requests
File two: Articlelist.js
The morning of the page to pass the value of the Chinese characters, the data has not gone through. Later colleagues to help solve, in controller layer plus @responsebody
@ResponseBody indicates that the return result of the method is written
$.ajax ({Type: "Post",Url:url,DataType: ' HTML ',Success:function (data) {},Complete:function (XMLHttpRequest, Textstatus) {},Error:function () {}});
success: The function that is called when the request succeeds. This function will get a parameter:
The main reason that Ajax can increase the speed of page loading is to reduce the loading of duplicate data through Ajax, that is, to load the data while the data is cached in memory, once the data is loaded, as long as the page is not refreshed,
Today to do the project, almost all submissions are submitted through AJAX, I test found that the data is the same after each commit, debugging can exclude background code problems, so the problem must be out of the foreground. Each time the cache
When using Ajax to perform an asynchronous refresh of a part of a page, after grabbing the packet, you can find that the problem is that if the contents of the form are unchanged, it does not make a request to the server, but instead caches the
Most of the time when uploading files, they are submitted using a form. There are several ways to upload a file using the form form:
1, the interface directly using the Submit button submitted. This way you can achieve the effect but there is no
1. Setting Up Xmlhttprequest/msxml2.xmlhttp objects
This should be the most common way, very easy to use, can really connect XML objects,
Can be submitted by "POST" "GET",
However, cross-domain is not supported in Firefox
2. Use DOMDocument object,
Overtime is to not work overtime.Two parameters passed from the foreground, packed into: {"User": {"name": "ASD", "Age": 22}}Springmvc parameters such as: public void test (@RequestBody user user) { ...}is not received, the property always
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service