XajaxResponse class usage

Source: Internet
Author: User

A collection of common methods of the xajaxResponse class is now available in the latest XAJAX version 0.5 Beta4. However, all the information available on the Internet is in version 0.25. There is no way to read the source code by yourself. The core of xajax is actually the xajaxResponse class. Here we have sorted out its common methods:

1.XajaxResponse-> confirmCommands ($ iCmdNumber, $ sMessage)
In the displayed dialog box, the content is $ sMessage, and the first parameter $ iCmdNumber is a number. If "yes" is selected, one or more statements after the statement are executed. If "no" is selected, the previous $ iCmdNumber statement is skipped and then executed, that is, only the statements starting with the $ iCmdNumber clause (excluding the $ iCmdNumber clause) will be executed.
For example: $ xResponse-> confirmCommands (4, 'check whether the record is actually deleted ');

2.XajaxResponse-> assign ($ sTarget, $ sAttribute, $ sData)
Assign a value to the attribute whose element ID is $ sTarget, and assign its attribute $ sAttribute to $ sData.
Example: $ xResponse-> assign ('mydiv ', 'innerhtml', 'Hello world! This is a example of xajax! ');
$ XResponse-> assign ('mydiv ', 'style. color', 'blue ');
$ XResponse-> assign ('forminput', 'value', 'bill ');

3.XajaxResponse-> append ($ sTarget, $ sattriend, $ sData)
Assign a value to the element attribute with ID $ sTarget in append mode. Append the value $ sData to the original value of its attribute $ sAttribute.
Example: $ xResponse-> append ('mydiv ', 'innerhtml', 'this is append comment ');

4.XajaxResponse-> prepend ($ sTarget, $ sattrid, $ sData)
Same as above. It is a pre-assigned value. What is pre-assignment.

5.XajaxResponse-> replace ($ sTarget, $ sAttribute, $ sSearch, $ sData)
Replace the attribute value of the element whose ID is $ sTarget. Replace all $ sSearch values in the $ sAttribute value with $ sData.
Example: $ xResponse-> replace ('mydiv ', 'innerhtml', 'xajax ',' <strong> xajax </strong> ');
[I suddenly understood how GOOGLE, BAIDU, and other search engines highlighted keywords on the search pages.]

6.XajaxResponse-> clear ($ sTarget, $ sAttribute)
Clear the element property value whose ID is $ sTarget. Clears the value of its $ sAttribute attribute.
Example: $ xResponse-> clear ('mydiv ', 'innerhtml ');

7.XajaxResponse-> alert ($ sMsg)
The dialog box is $ sMsg. That is, the window. alert () method in JS.
Example: $ xResponse-> alert ('How are you? ');

8.XajaxResponse-> redirect ($ sURL, $ iDelay = 0)
Redirection. Change the browser $ iDelay to $ sURL in seconds. $ IDelay is omitted. The default value is 0. That is, the window. location () method in JS.
Example: $ xResponse-> redirect ('HTTP: // www.sohu.com ', 15 );

9.XajaxResponse-> script ($ sJS)
Execute a JS script. The $ sJS parameter is the JS Code.
Example: $ xResponse-> script ("alert (\" hello world \")");

10.XajaxResponse-> create ($ sParent, $ sTag, $ sId, $ sType = null)
Create a $ sTag element under the existing element $ sParent and set its ID to $ sId.
Example: $ xResponse-> create ('mydiv ', 'span', 'myspan ');

11.XajaxResponse-> remove ($ sTarget)
Removes an element with the ID of $ sTarget.
Example: $ xResponse-> remove ('mydiv ');

12.XajaxResponse-> insert ($ sBefore, $ sTag, $ sId)
Insert an element $ sTag before the current element $ sBefore, and set the ID of the $ sTag element to $ sId.
Example: $ xResponse-> insert ('myspan ', 'P', 'myp ');

13.XajaxResponse-> insertAfter ($ sAfter, $ sTag, $ sId)
The same as above, except that the element is not inserted before, but after the element $ sAfter.

14.XajaxResponse-> createInput ($ sParent, $ sType, $ sName, $ sId)
Create an INPUT element with $ sParent as the parent element and set its type to $ sType [I .e.: type = "$ sType"]. set the element NAME to $ sName [I .e.: name = "$ sName"], and the element ID to $ sId [I .e.: id = "$ sId"].
Example: $ xResponse-> createInput ('mydiv ', 'text', 'username', 'input1 ');

15.XajaxResponse-> insertInput ($ sBefore, $ sType, $ sName, $ sId)
Insert an INPUT element before the element $ sBefore and set: type = "$ sType" name = "$ sName" id = "$ sId ".
Example: $ xResponse-> insertInput ('input1', 'Password', 'userpass', 'input2 ');

16.XajaxResponse-> insertInputAfter ($ sAfter, $ sType, $ sName, $ sId)
Insert an INPUT element after the element $ sAfter and set: type = "$ sType" name = "$ sName" id = "$ sId ".
Example: $ xResponse-> insertInputAfter ('input2', 'text', 'checkcode', 'input3 ');

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.