2019.1

Table Of Contents
file:///c:/somefolder/somecontent.html.
When using the http/https protocol, remember that only absolute paths are supported inside
remote snippets (see "Remote snippets" on page714).
selector
String. The supplied selector should conform to CSS selector syntaxand allows you to
retrieve only the content of matching elements.
Examples
This script loads a specific element from a snippet and uses that to replace the results (the
HTML element or set of HTML elements matched by the selector of the script; see "results" on
page1314).
var mysnippet = loadhtml('snippets/snippet-
selectors.html','#item3');
results.replaceWith(mysnippet);
This script loads the children of the selected element.
var snippet = loadhtml
('file:///C:/Users/PParker/Documents/Example.html','foobar').childr
en();
results.replaceWith(snippet);
The next script loads a remote snippet (see "Remote snippets" on page714), looks for an H1
heading and uses that text.
var post = loadhtml('snippets/post.rhtml');
var h1 = query('h1', post).text();
results.text(h1);
Another example is given in the following how-to: Using a selector to load part of a snippet.
loadjson()
Creates a JSON object based on the text retrieved fromthe suppliedlocation. The function lets
you retrieve content from a JSON enabled server using a standard HTTP request. Popular
content management systems like WordPress (requires JSON API plugin) and Drupalprovide
a JSON service/API to retrieve content.
Page 1270