source: trunk/web-app/js/taskShow.js @ 831

Last change on this file since 831 was 831, checked in by gav, 13 years ago

Refactor taskShow.js.

File size: 970 bytes
Line 
1
2// Load an Entry from via AJAX.
3// @container Container object to load response into.
4// @button Button object used to trigger this function.
5// @args Params map to pass to actionUrl.
6function loadEntryForm(container, button, params) {
7
8    var actionUrl = getContextPath()+"/entryDetailed/ajaxCreate/";
9
10    function success(data, textStatus, jqXHR){
11        container.html(data);
12        jQuery('html,body').animate({scrollTop: container.offset().top}, 800, function() {
13            container.css("border", "1px solid #006DBA");
14            container.find(':input[name="comment"]').focus();
15        });
16    }
17
18    function error(jqXHR, textStatus, errorThrown){
19        container.html(errorIndication().slideDown(600));
20        button.show(600);
21    }
22
23    // Start.
24    button.hide(600);
25    container.html(loadingIndication().slideDown(600));
26
27    jQuery.ajax({
28        url: actionUrl,
29        data: params,
30        success: success,
31        error: error
32    });
33}
Note: See TracBrowser for help on using the repository browser.