sendAjax - POST

sendAjax sends POST requests to an API

sendAjax(URL, { "template_id": "5fb24900c044b60f4a8758c1", "data": { "USERNAME": "Nexweaver" } }, "POST", "console.log(data)",{"X-API-KEY": API-KEY})

sendAjax(url, data = {}, Method = "GET", callback = '', headers = {}, dataType , contentType) 

Parameters: URL: url for the API you are calling Data: Post body for a sendAjax POST request (null or {} for GET request) Method: GET or POST Callback: data returned from call - general pattern is to put "window.data = data;console.log(data)" so you can access window.data in the rest of the code Headers: Any additional headers needed by the API like API key or username/password Datatype: What kind of response to expect, for example "json" or "text" ContentType: What kind of header to send, for example "application/json

Last updated