Purpose
Fetch the raw JSON returned by LifeWise's school-name search endpoint without loading the site's UI.
When to Use
Use when a caller needs school-name search results for a query, state, and charter-status filter.
Workflow
- Construct the endpoint directly:
https://lifewise.org/wp-admin/admin-ajax.php?action=school_name_search&q={query}&state={state}&charter={charter}. URL-encode{query}and{state}; use the site's boolean representation for{charter}(for example,false). - In one browser call, navigate to that URL with
waitUntil: "domcontentloaded", then run this extractor viaevaluate()on the loaded response page:
(() => {
const text = (
document.body?.textContent ||
document.documentElement?.textContent ||
""
).trim();
if (!text) return null;
try {
return JSON.parse(text);
} catch (error) {
throw new Error("Expected JSON response, received: " + text.slice(0, 500));
}
})();- Return the evaluator's parsed value as the JSON response.
Site-Specific Gotchas
- This is a WordPress
admin-ajax.phpendpoint, so the response is raw JSON rather than a normal page. - Preserve all query parameters, especially
action=school_name_search,state, andcharter; an emptyqis valid and returns the broader state-filtered result. - Read
document.body.textContentrather than relying on rendered selectors; the response page has no stable result-card DOM.
Expected Output
The parsed JSON value returned by the endpoint, typically an array or object containing the matching school records.