This thing is very simple, as long as you will use aspx,jsp,php and so on any kind of server language or framework, know how to get the page pass parameters on the line.
ExtJS's Ajax is even shorter than jquery's.
I. BASIC OBJECTIVES
For example, as an extremely simple example, ajax.html has a button, a click, passing a=10 and b= 20 these two values go to helloworld.jsp or helloworld.php, and then helloworld.jsp or helloworld.php return information to the foreground:
Second, the JSP version of the ExtJS Ajax
1. Create a new dynamic Web Project in eclipse for Java EE, and automatically generate the XML, and delete the unimportant thing in this web. XML, as follows:
<?xml version= "1.0" encoding= "UTF-8"? ><web-app xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns= "Http://java.sun.com/xml/ns/javaee" xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee/http Java.sun.com/xml/ns/javaee/web-app_3_0.xsd "id=" webapp_id "version=" 3.0 "></web-app>
After the EXTJS4 in the required css,js copy to the WebContent folder, this thing in the "ExtJS" ExtJs4.2.1 Configuration and HelloWorld "(Click to open the link) has been said, after the directory structure, such as Lib nothing, No additional jar packages are required.
2, the new ajax.html as follows, there is an ID of btn1 button, the key is the introduction of EXTJS resources after the script, very simple, indicating that the BTN1 is clicked after the action, to helloworld.jsp this page, pass parameters a=10,b= 20 then passed as post, Helloworld.jsp returned is a plain text response.responsetext that removes HTML tags, generally AJAX only transmits JSON and text.
<! DOCTYPE html>3, helloworld.jsp This page is more simple, just the JSP version of the acquisition parameters, and then this parameter to print out. JSP just getting started in metropolis.<%@ page language= "java" contenttype= "text/html; Charset=utf-8 " pageencoding=" UTF-8 "%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
Third, PHP version of the ExtJS Ajax1, php more simple, even the web. XML and webcontent These annoying things are not, its directory structure is as follows, and the above basic
2, ajax.html the response page changed from helloworld.jsp to helloworld.php, the other word has not changed
<! DOCTYPE html>3, helloworld.php is also the beginning of PHP children's shoes will be, simple to get parameters, and then this parameter printed out<?php$a=$_request["a"]; $b =$_request["B"];echo "HelloWorld," a ". $a.", "said the B. $b;? >
The results of the operation are as follows:
Ajax of the "ExtJS" ExtJS