Enable Cors to implement Ajax Cross-domain requests One day of the month, you need to implement a requirement to send a request to another site with Ajax in the current site,b.com -> S.com, just start to think that nothing, not just a request,
In the recent development process, using AJAX to asynchronously fetch pictures. In the development of this feature is not a problem, you can later test, redeployment after the problem, this is the problem of Ajax Cross-domain.
Ajax itself does not
Page scroll to bottom auto Ajax get article
The code is as follows
Copy Code
var _timer = {};function delay_till_last (ID, FN, wait) {if (_timer[id]) {Window.cleartimeout (_timer[id]);Delete _timer[id];}return _timer[id]
HTML below, we have this page let Dedecms call the data News tab
The code is as follows
Copy Code
Dedecms Template label is like {dede:arclist typeid= ' 3 ' row= ' 6 ' orderby= ' ID '} [field:title/]{/dede:arclist}
Note: I simply use cookies to prevent repetitive voting, and I'm sure I can cheat, and the safest thing is to sign up for a vote.
The code is as follows
Copy Code
Events Program Voting 10-year graduation student
The Chinese parameter processing code is passed in Ajax:
The code is as follows
Copy Code
JS in:Send_request (' http://www.111cn.net/mini_do.php?username= ' + encodeuri (username) + ' &phone= ' + encodeuri (phone) + '
Ajax to post, the URL in the form of "url?param=xx¶m2=xx", if the parameters are passed in Chinese or Japanese, background to receive parameters will appear garbled, suspected "Hao? Innocent?" ㄨ?? rdquo;. At this point we need to encode the URL
Problem analysis
First the container, the first is hidden.
The code is as follows
Copy Code
This div is empty and is used to put the contents of the $.load () into it.
When we click the "View" button,
The code is as follows
Copy Code
Using System;Using System.Web;Using System.Data.SqlClient;Using System.Data;Using System.Collections.Generic;Using System.Web.Script.Serialization;public class Getdata:ihttphandler {public void
Using Ajaxmethod can asynchronously invoke the server-side method in the client, simply call the background in JS. cs file in the method, do some JS can not do the operation, such as query the database. Use Ajaxmethod to satisfy a few points:
1. If
As the parameter pass through the URL behind the background can also be taken, but see send parameters can also be sent parameters, test the server side to accept not send parameters, in the Firebug see sent the request post part is a string, not
The client initiates a browse request to a URL, the server resolves the request, and in character encoding parsing, first he checks the character encoding setting in the page, namely In ext, in the process of submitting data, the EXT framework is
It was not too short to learn the code, but ajax was rarely used. Later I learned about it. The following is my opinion and understanding of ajax as a newcomer to ajax.Ajax: asynchronous requests. By performing a small amount of data exchange with
Cross-origin occurs when AJAX requests from one domain to another. So how can I implement ajax cross-origin requests on nginx? To enable cross-origin requests on nginx, add the add_header Access-Control * command. As follows:Location /{Add_header
The ajax authentication Username. Today we will talk about the method for verifying the username through ajax again. I have written code many times before. Now I am only talking about ideas and not writing code, if you want to find the code, please
// call the database,'Dim pagesize'SQL = "select top 1 * from [pagesize] order by id desc"'Rs. open SQL, conn, 1, 1'Pagesize = rs ("pagesize ")'Rs. CloseIf session ("pagesize") = "" Then session ("pagesize") = 9Dim pagePage = unescape (Request.
There are two files in total. The first file is index.html, which is used to display files, and the second file is processed by the p. asp file and returned to the page.Let's take a look at the results:Below is the page index.html AJAX static paging
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