For the problem from the background to get the JSON data, fill the content to the Drop-down list, the code is very simple, the specific process see the code below.
Requirements:URL: Link par:id sel: dropdown list Selector
Get Drop-down List
Sina blog previously wrote JS call Ajax when get and post garbled solution, but the use of JS code is more cumbersome, we use AJAX for data interaction can use JS a mature framework---jQuery.
The design of a Web site, whether registering or paging,
Copy Code code as follows:
Grammar:
$ (function () {
The var callback = function (r) {//R represents the data returned by the background data.
}
$.get ("", callback); The path to write the method inside quotation marks
});
Objective:
I see the title is very long, there are so many functions, in fact, the simplification is a function, asynchronous form submission, only in the asynchronous form submit this large function, can realize the image upload, simulation Ajax
First, some basic knowledge of JSON.
The objects in JSON are identified by "{}", and a "{}" represents an object, such as {"Areaid": "123"}, and the object's value is the form of a key-value pair (key:value).
"[]", identifies an array, and splits
The new Global Consortium strategy enables HTTP Cross-domain access, and I've been looking for a long time to solve this problem:
Only the header information returned in the servlet needs to be added
Access-control-allow-originThis can be.
For
Ajax Cross-domain operation has been a difficult problem, now the main solutions are:
1, JSONP (need to support on the server side)
2, IFrame (can only operate in the subdomain)
3, page agent (this a little omnipotent)
4, Access-control-allow-origin
Copy Code code as follows:
$.ajax ({
Async:true,//default True (asynchronous request)
Cache:true,//default True, set to False will not load request information from the browser cache.
Type: "POST",//default: Get request mode: [Post/get]
Copy Code code as follows:
get Sina Short URL
Long URL:
enter your App_key (no searchable online):
URL:
Call address:
click me
URL:-->
Reference article: Take short chain service for example, Explore Appkey,
Today, with Firefox debugging a way to use jquery inside the package of interaction with the background, Firefox anyway does not play windows.
And the previous use of Google browser smoothly through. It was then found that the browser defaults were
Myscript.js
Copy Code code as follows:
var _autorun;
var str = new Array (' Forward what ', ' share what ', ' forwarded ', ' transferred ', ' forwarding ', ' continue to apply ', ' in no ', ' sent ', ' to forward ', ' to share ', '
Recently, the company's projects have changed a lot of pagination to the Ajax front page paginationPreviously written paging plugin is not used, so rewrite a
Supports ie6+, but no animation effectIf there is no hard demand, personally think that
This example describes the use of the Get () method of Ajax in jquery. Share to everyone for your reference. The specific analysis is as follows:
$.get () Requests data from the server through an HTTP GET request.
Syntax structure:
Copy Code
See the Js,ajax request address written by someone and add random parameters, such as xxxx?t= + new Date (). GetTime ().
At first I did not understand why, the Internet to check the data, the reason is to prevent browser caching.
Browsers cache
The foreground uses the Ajax direct call backstage method, the old person posts the question, does not have the example
The following is done by a foreground with Jquery,ajax calling the backend method do the No Refresh Cascade menu
Casmenu.aspx
RSS is an xml-based file standard that can be easily shared between Web sites through XML files that conform to the RSS specification. Ajax is the abbreviation for asynchronous JavaScript and XML. Ajax technology allows a request to be made to a
Ajax submission is through JS to submit the request, the request and response by the JS engine to deal with, the page will not refresh, the user does not feel the actual browser issued a request. For example, we want the page to always show the
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.