1 Class: Request.HTML {#Request-HTML}
2 ===================================
4 Request Specifically made for receiving HTML.
12 var myHTMLRequest = new Request.HTML([options]);
16 1. options - (*object*, optional) See options below. Also inherited are all the options from [Request][].
20 * evalScripts - (*boolean*: defaults to true) If set to true, `script` tags inside the response will be evaluated. This overrides the `false` default from Request.
21 * update - (*element*: defaults to null) The Element to insert the response text of the Request into upon completion of the request.
22 * append - (*element*: defaults to null) The Element to append the response text of the Request into upon completion of the request.
23 * filter - (*mixed*: defaults to null) To filter the response tree by a selector or function. See [Elements:filter][]
29 * (*function*) Function to execute when the HTML request completes. This overrides the signature of the Request success event.
33 onSuccess(responseTree, responseElements, responseHTML, responseJavaScript)
37 1. responseTree - (*element*) The node list of the remote response.
38 2. responseElements - (*array*) An array containing all elements of the remote response.
39 3. responseHTML - (*string*) The content of the remote response.
40 4. responseJavaScript - (*string*) The portion of JavaScript from the remote response.
44 * (*object*) A new Request.HTML instance.
48 #### Simple GET Request:
50 var myHTMLRequest = new Request.HTML().get('myPage.html');
52 #### POST Request with data as String:
54 var myHTMLRequest = new Request.HTML({url:'myPage.html'}).post('user_id=25&save=true');
56 #### Data from Object Passed via GET:
58 //Loads "load/?user_id=25".
59 var myHTMLRequest = new Request.HTML({url:'load/'}).get({'user_id': 25});
61 #### Data from Element via POST:
65 <form action="save/" method="post" id="user-form">
67 Search: <input type="text" name="search" />
68 Search in description: <input type="checkbox" name="search_description" value="yes" />
69 <input type="submit" />
75 //Needs to be in a submit event or the form handler.
76 var myHTMLRequest = new Request.HTML({url:'save/'}).post($('user-form'));
83 Object: Element.Properties {#Element-Properties}
84 ==============================================
86 see [Element.Properties][]
88 Element Property: load {#Element-Properties:load}
89 -------------------------------------------------
93 Sets a default Request.HTML instance for an Element.
97 el.set('load'[, options]);
101 1. options - (*object*) The Request options.
105 * (*element*) The target Element.
109 el.set('load', {evalScripts: true});
110 el.load('some/request/uri');
115 Returns either the previously set Request.HTML instance or a new one with default options.
123 1. property - (*string*) the Request.HTML property argument.
127 * (*object*) The Request instance.
131 el.set('load', {method: 'get'});
132 el.load('test.html');
133 // the getter returns the Request.HTML instance, making its class methods available.
134 el.get('load').post('http://localhost/script');
138 Type: Element {#Element}
139 ========================
141 Custom Type to allow all of its methods to be used with any DOM element via the dollar function [$][].
143 Element Method: load {#Element:load}
144 ------------------------------------
146 Updates the content of the Element with a Request.HTML GET request.
154 1. url - (*string*) The URL pointing to the server-side document.
158 * (*element*) The target Element.
164 <div id="content">Loading content...</div>
168 $('content').load('page_1.html');
174 - [$][], [Request](/Request/Request)
176 [Request]: /core/Request/Request
177 [$]: /core/Element/Element/#Window:dollar
178 [Element.Properties]: /core/Element/Element/#Element-Properties
179 [Elements:filter]: /core/Element/Element#Elements:filter