Changes between Initial Version and Version 1 of ajaxS3


Ignore:
Timestamp:
02/28/10 13:21:32 (15 years ago)
Author:
Serge Sunneach
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ajaxS3

    v1 v1  
     1DeveloperGuidelines DeveloperGuidelinesTips
     2
     3== ajaxS3 - the real world connectivity tool ==
     4
     5When there is too much data to download,
     6or the connection is slow,
     7or the server is busy
     8or all of the above,
     9
     101. the user would prefer to monitor the browser-server dialogue;
     112. the browser would need to re-submit the Ajax request again in the case of timeout.
     12
     13The [http://bazaar.launchpad.net/~flavour/sahana/sahanapy-trunk/annotate/head%3A/static/scripts/S3/S3.js ajaxS3] covers these needs.
     14
     15
     16This is a transparent jQuery plugin residing in the S3.js (S3.min.js) which works transparently as a regular ajax handle,
     17but behind the scenes:
     18
     191. It shows the flashing message that the download is started
     202. It sets up the timeout and re-tries the request several times if the timeout is triggered
     213. It displays the status and errors in the custom StatusBar
     22
     23That way the user always feels and stays in control.
     24
     25'''How to use the ajaxS3?'''
     26[[BR]]
     27The standard handles have been provided: ''getS3'', ''getJSONS3'', ''postS3'', and the ''ajaxS3'' itself.[[BR]]
     28
     29
     30getJSONS3
     31{{{
     32$.getJSONS3(url, callback)
     33$.getJSONS3(url, callback, message)
     34$.getJSONS3(url, data, callback)
     35$.getJSONS3(url, data, callback, message)
     36}}}
     37 These calls will get the JSON from the URL and use the provided callback when successful.
     38{{{
     39#!js
     40callback(theJSON_you_need, status)
     41}}}
     42getS3
     43 It is the same as '''getJSONS3''', but now the type can be `html` or `json`
     44{{{
     45#!js
     46$.getS3(url, callback, type) 
     47$.getS3(url, callback, type, message)
     48$.getS3(url, data, callback, type)
     49$.getS3(url, data, callback, type, message)
     50}}}
     51postS3
     52 The same as '''getS3''', but now the request goes through the POST tunnel:
     53{{{
     54#!js
     55$.postS3(url, callback, type) 
     56$.postS3(url, callback, type, message)
     57$.postS3(url, data, callback, type)
     58$.postS3(url, data, callback, type, message)
     59}}}
     60
     61Why the ''message'' argument?[[BR]]
     62The call `$.getJSONS3(url, callback)` will show status something like:
     63{{{
     64"getting form data..."
     65"getting form data... retry 1"
     66...
     67}}}
     68And the call `$.getJSONS3(url, callback, 'line items')` will show:
     69{{{
     70"getting line items..."
     71"getting line items... retry 1"
     72...
     73}}}
     74DeveloperGuidelines DeveloperGuidelinesTips