Ajax

deferredPost (url: string, data: PostData): void

Utility function to throttle repeated POST requests. A request to the same URL will be made at most every 5s, and the corresponding data objects will be deep-merged.

Name Type Default Description
url string    
data PostData    

fromQueryString (str: string): Obj<string>

Converts an HTML query string to JSON object.

Name Type Default Description
str string    

loadImage (url: string, credentials: boolean): Promise<HTMLImageElement>

Asynchronously loads an Image.

Name Type Default Description
url string    
credentials boolean false  

loadImageDataURI (args: []): Promise<string>

Name Type Default Description
args []    

loadScript (src: string): Promise<unknown>

Asynchronously loads and executes a JS script.

Name Type Default Description
src string    

post (url: string, data: PostData|FormData): Promise<string>

Asynchronously loads a resource using a POST request. This utility function automatically form-encodes JSON data and adds a CSRF header.

Name Type Default Description  
url string      
data PostData FormData    

toQueryString (data: PostData): string

Converts a JSON object to an HTML query string.

Name Type Default Description
data PostData    

Copyright © 2024 Mathigon.org