Revision 17f39e02
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/ClientJS.pm | ||
---|---|---|
14 | 14 |
|
15 | 15 |
my %supported_methods = ( |
16 | 16 |
# ## Non-jQuery methods ## |
17 |
flash => 2, # display_flash(<TARGET>, <ARGS>) |
|
17 |
flash => 2, # kivi.display_flash(<TARGET>, <ARGS>)
|
|
18 | 18 |
|
19 | 19 |
# ## jQuery basics ## |
20 | 20 |
|
... | ... | |
217 | 217 |
First some JavaScript code: |
218 | 218 |
|
219 | 219 |
// In the client generate an AJAX request whose 'success' handler |
220 |
// calls "eval_json_response(data)":
|
|
220 |
// calls "eval_json_result(data)":
|
|
221 | 221 |
var data = { |
222 | 222 |
action: "SomeController/the_action", |
223 | 223 |
id: $('#some_input_field').val() |
224 | 224 |
}; |
225 |
$.post("controller.pl", data, eval_json_response);
|
|
225 |
$.post("controller.pl", data, eval_json_result);
|
|
226 | 226 |
|
227 | 227 |
Now some Perl code: |
228 | 228 |
|
... | ... | |
278 | 278 |
|
279 | 279 |
=item 1. The "client_js.js" has to be loaded before the AJAX request is started. |
280 | 280 |
|
281 |
=item 2. The client code needs to call C<eval_json_response()> with the result returned from the server.
|
|
281 |
=item 2. The client code needs to call C<kivi.eval_json_result()> with the result returned from the server.
|
|
282 | 282 |
|
283 | 283 |
=item 3. The server must use this module. |
284 | 284 |
|
Auch abrufbar als: Unified diff
client_js.js: Funktionen in namespace kivi verschoben