You are here

README.txt in Ajax markup 6

Same filename and directory in other branches
  1. 7 README.txt
- Ajax markup:
Provides an API for generating filtered markup using ajax.

- INSTALL:
Just enable it at module administration page.

- USE:
1) Load the API by calling ajax_markup_on() at server side.

if (module_invoke('ajax_markup', 'on')) {
  drupal_add_js(YOUR_SCRIPT.js);
}

2) Inside YOUR_SCRIPT.js call $.ajaxMarkup

$.ajaxMarkup(INPUT, INPUT_FORMAT, CALLBACK);

function CALLBACK(OUTPUT, SUCCESS, REQUEST) {
  if (SUCCESS) $('div#preview').html(OUTPUT);
  else alert(OUTPUT);
}

INPUT: String of which you want to get a filtered version.
INPUT_FORMAT: Integer representing one of the drupal input formats. Provide 0 for the default.
CALLBACK: Function to send the output after the request.
OUTPUT: String that is the filtered INPUT. Content depends on the INPUT_FORMAT and SUCCESS state.
SUCCESS: Boolean representing the status of the request.
REQUEST: XmlHttpRequest. Not available when the OUTPUT is retrieved from the cache.

- ALSO:
API provides a function that tries to get the INPUT_FORMAT of a textarea.

$.ajaxMarkup.getFormat('#edit-body'); //returns 0 (the default format) when there is no input format for the element.

- ACCESS:
Users must have "access ajax markup" permission.
Users must have access to the supplied INPUT_FORMAT, otherwise the default format is used.

File

README.txt
View source
  1. - Ajax markup:
  2. Provides an API for generating filtered markup using ajax.
  3. - INSTALL:
  4. Just enable it at module administration page.
  5. - USE:
  6. 1) Load the API by calling ajax_markup_on() at server side.
  7. if (module_invoke('ajax_markup', 'on')) {
  8. drupal_add_js(YOUR_SCRIPT.js);
  9. }
  10. 2) Inside YOUR_SCRIPT.js call $.ajaxMarkup
  11. $.ajaxMarkup(INPUT, INPUT_FORMAT, CALLBACK);
  12. function CALLBACK(OUTPUT, SUCCESS, REQUEST) {
  13. if (SUCCESS) $('div#preview').html(OUTPUT);
  14. else alert(OUTPUT);
  15. }
  16. INPUT: String of which you want to get a filtered version.
  17. INPUT_FORMAT: Integer representing one of the drupal input formats. Provide 0 for the default.
  18. CALLBACK: Function to send the output after the request.
  19. OUTPUT: String that is the filtered INPUT. Content depends on the INPUT_FORMAT and SUCCESS state.
  20. SUCCESS: Boolean representing the status of the request.
  21. REQUEST: XmlHttpRequest. Not available when the OUTPUT is retrieved from the cache.
  22. - ALSO:
  23. API provides a function that tries to get the INPUT_FORMAT of a textarea.
  24. $.ajaxMarkup.getFormat('#edit-body'); //returns 0 (the default format) when there is no input format for the element.
  25. - ACCESS:
  26. Users must have "access ajax markup" permission.
  27. Users must have access to the supplied INPUT_FORMAT, otherwise the default format is used.