AJAX wrapper class usage guide

亚连
Release: 2018-05-25 14:44:31
Original
1367 people have browsed it

This article mainly introduces the guide to the use of AJAX encapsulation classes. Friends who need it can refer to it.

AJAX feels difficult to talk about, but if you encapsulate it, you will find that it is very simple to use, of course. Simple applications, such as message board applications, etc. First of all, let me give you a gift, which is a packaged AJAX class. The download address is http://xiazai.jb51.net/201412/yuanma/ajax3.0(jb51 .net).rar Download this class here and teach you how to use it!
Example!

  Ajax实例  

内容加载中.....

用户名:
内容:
Copy after login

First add our ajax3.0.js file, and then we will write this Ajax().post("save.php", datao, function(data))
ajax( ) The first of the two parameters returns xml json or html. The second one is true for asynchronous transmission and false for synchronous transmission. You will understand after the post.
The bottom is the php file

//read.php @readfile("demo.txt"); //save.php // header("Content-Type:text/html;charset=gb2312") $username=$_POST["username"]; $desn = $_POST["desn"]; $fh = fopen("demo.txt", "a"); $text=$username."--".date("Y-m-d H:i:s")."说:".$desn."
"; fwrite($fh, $text); fclose($fh); //demo.text fdsafdsa--2012-11-01 12:24:04说:fdsafdsa
fdsafdsa--2012-11-01 12:24:07说:fdsafdsafsa
111--2012-11-01 12:25:07说:2222
eeee--2012-11-01 12:25:10说:eeee
fdsfds--2012-11-01 12:25:12说:fdsfdsfds
fdsfds--2012-11-01 12:25:19说:fdsfdsfs
fdsfdsf--2012-11-01 12:25:22说:sfdsfdsfds
fdsafdsa--2012-11-01 12:26:00说:fdsafdsa
Copy after login

The above is what I compiled for everyone. Yes, I hope it will be helpful to everyone in the future.

Related articles:

How to solve the 403 error when django uses ajax post data

A brief analysis of IE’s caching problem for Ajax request results

A detailed explanation of the use of various AJAX methods

The above is the detailed content of AJAX wrapper class usage guide. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!