Use of the Xajaxresponse class

Source: Internet
Author: User

Now the latest Xajax version has been 0.5 Beta4. But the information that can be found on the net is only 0.25 edition. There is no way to see the source code itself. The core of Xajax is actually the Xajaxresponse class, and here's how it's commonly used:

1. Xajaxresponse->confirmcommands ($iCmdNumber, $sMessage)
Pop-up Query dialog box, ask the content for $smessage, the first parameter $icmdnumber as a number. If the user chooses "yes", then one or more sentences after this statement are executed, and if the user chooses "No", then the $icmdnumber sentence is skipped before execution, that is, only statements from the $icmdnumber sentence (excluding the $icmdnumber sentence) will be executed.
Example: $xResponse->confirmcommands (4, ' Please confirm whether the record is really deleted ');

2. Xajaxresponse->assign ($sTarget, $sAttribute, $sData)
Assign a value to an attribute whose element ID is $starget, and assign its property $sattribute value 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, $sAttribute, $sData)
Assign a value to an element attribute with an ID of $starget appended. Append the assignment $sdata on the basis of the original value of its property $sattribute.
Example: $xResponse->append (' mydiv ', ' InnerHTML ', ' is append comment ');

4. Xajaxresponse->prepend ($sTarget, $sAttribute, $sData)
Ditto, is a pre-assigned value. The specific what is the pre-assignment, has not yet figured out.

5.xajaxresponse->replace ($sTarget, $sAttribute, $sSearch, $sData)
Replaces the property value of an element with an ID of $starget. Replaces all values containing $ssearch in the value of the attribute $sattribute with $sdata.
Example: $xResponse->replace (' mydiv ', ' InnerHTML ', ' xajax ', ' <strong>xajax</strong> ');
[Suddenly understand the search engine google,baidu such as the keyword highlighting is how to achieve. ]

6. Xajaxresponse->clear ($sTarget, $sAttribute)
Clears the element attribute value with ID $starget. Clears the value of its $sattribute property.
Example: $xResponse->clear (' mydiv ', ' InnerHTML ');

7. Xajaxresponse->alert ($SMSG)
A pop-up dialog box with $smsg content. That is, the Window.alert () method in JS.
Example: $xResponse->alert (' How to Are you? ');

8. Xajaxresponse->redirect ($sURL, $iDelay =0)
redirect. Let the browser $idelay seconds before turning to $surl. The default is 0 when the $iDelay is omitted. That is, the window.location () method in JS.
Example: $xResponse->redirect (' http://www.sohu.com ', 15);

9. Xajaxresponse->script ($sJS)
Execute a section of JS script. Parameter $sjs to JS code.
Example: $xResponse->script ("Hello World");

10.xajaxresponse->create ($sParent, $sTag, $sId, $sType =null)
Creates a $STAG element under the current existing element $sparent and sets its ID to $sid.
Example: $xResponse->create (' mydiv ', ' span ', ' myspan ');

Xajaxresponse->remove ($sTarget)
Remove an element with ID $starget
Example: $xResponse->remove (' mydiv ');

12.xajaxresponse->insert ($sBefore, $sTag, $sId)
Inserts an element $stag before the current element $sbefore and sets the ID of the $stag element to $sid.
Example: $xResponse->insert (' MySpan ', ' P ', ' MYP ');

13.xajaxresponse->insertafter ($sAfter, $sTag, $sId)
Ditto, except that the element is not inserted before and is inserted after the element $safter.

14.xajaxresponse->createinput ($sParent, $sType, $sName, $sId)
To $sparent as the parent element, create an INPUT element and set its type to $stype[that is: type= "$sType", set the element's name to $sname[that is: Name= "$sName"], and set the element ID to $sid[namely: 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)
Inserts an INPUT element after the element $safter and sets: Type= "$sType" name= "$sName" id= "$sId".
Example: $xResponse->insertinputafter (' input2 ', ' text ', ' Checkcode ', ' input3 ');

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.