append(<selector>, <html>)
Append the <html>
to the inside of the element selected by <selector>
. The selector used can be any valid JQuery selector.
...
send_directive(<name>) with options
Send a directive to the endpoint. Action modifiers are used to send directive options:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
appendsend_directive("#foo", "<p>This is the text</p>")my_directive") with body = "Hello World" |
The <name>
can be any text that identifies the directive to the endpoint.
The options are given as a map. The map can include any keys and values that the developer wishes.
A module exists for that simplifies working with send_directive.
The following ruleset shows appendsend_directive() being used
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
ruleset a1299x164a1299x188 { meta { name "AppendSend Directive Example" author "nathan cerny" logging offon } dispatch { // domain "exampley.com" } rule appendpage_example_ruleview { select usingwhen pageview ".*" pre { resp = append("#append", "<span style=\"color:red;\">| You fired the after rule </span>"http:get("http://webhooks.kynetxapps.net/h/a1299x188.dev/directive_example"); content = resp.pick("$..content"); } append("body", "<h1>Directive Response: </h1>" + content); } } |
The following demonstrates the preceding rule:
...
rule directive_example {
select when webhook directive_example
send_directive("text") with body = "my text response";
}
} |