Ajax markup

Component ID

504196

Component name

Ajax markup

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

15508

Component created

Component changed

Component body

Provides an AJAX API for creating filtered content by applying drupal input filters.

Features

  • supports BBCode, Markdown, Textile, HTML, PHP, and any other markup system provided as a drupal module
  • provides an ajaxified version of check_markup() of drupal
  • provides "access ajax markup" user permission
  • fully integrated into BUEditor. Button code:
    6.x-1.x: php: return module_invoke('ajax_markup', 'on') ? 'js: eDefAjaxPreview();' : '';
    6.x-2.x: js: E.prvAjax();

How to integrate (for developers)

  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);
    }