AJAX: Difference between revisions

From MidasWiki
Jump to navigation Jump to search
(The midas documentation has moved to https://midas.triumf.ca/docs/)
Tag: Replaced
 
(67 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= About =
The midas documentation has moved. See [https://midas.triumf.ca/docs/develop/api/javascript/deprecated/#ajax-interface AJAX interface] on the Deprecated web features page for the new documentation about the mhttpd AJAX commands.
 
This page will document the MIDAS AJAX functions accessible through special the mhttpd URLs.
 
= jset =
 
TBW
 
= jget =
 
TBW
 
= jcopy =
 
TBW
 
= jkey =
 
* JSONP: no
* parameters:
** ?odb=<code>ODB path</code>
* returns:
<pre>
  if (equal_ustring(getparam("cmd"), "jkey")) {
      show_text_header();
      if (isparam("odb") && db_find_key(hDB, 0, getparam("odb"), &hkey) == DB_SUCCESS) {
        db_get_key(hDB, hkey, &key);
        rsprintf("%s\n", key.name);
        rsprintf("TID_%s\n", rpc_tid_name(key.type));
        rsprintf("%d\n", key.num_values);
        rsprintf("%d\n", key.item_size);
        rsprintf("%d", key.last_written);
      } else
        rsputs("<DB_NO_KEY>");
      return;
  }
</pre>
* example: TBW
 
= jmsg =
 
* JSONP: no
* parameters:
** ?n=<code>number of messages to return</code>
* returns: output of cm_msg_retrieve()
<pre>
  if (equal_ustring(getparam("cmd"), "jmsg")) {
      i = 1;
      if (*getparam("n"))
        i = atoi(getparam("n"));
     
      show_text_header();
      cm_msg_retrieve(i, str, sizeof(str));
      rsputs(str);
      return;
  }
</pre>
* example: TBW
 
= jgenmsg =
 
* JSONP: no
* parameters:
** ?msg=<code>message text</code>
* returns: ???
<pre>
  if (equal_ustring(getparam("cmd"), "jalm")) {
      show_text_header();
      al_get_alarms(str, sizeof(str));
      rsputs(str);
      return;
  }
</pre>
* example: TBW
 
= jalm =
 
* JSONP: no
* parameters: no
* returns: text from al_get_alarms()
 
<pre>
  if (equal_ustring(getparam("cmd"), "jalm")) {
      show_text_header();
      al_get_alarms(str, sizeof(str));
      rsputs(str);
      return;
  }
</pre>
 
* example: TBW

Latest revision as of 22:00, 30 October 2026

The midas documentation has moved. See AJAX interface on the Deprecated web features page for the new documentation about the mhttpd AJAX commands.