ajax

Wrapper for js ajax

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version 0.1.1
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-08-31 07:15

Authors

  • stisa

Installation

nimble install ajax
choosenim install ajax
git clone https://github.com/stisa/ajax

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
ajax - - - - - - -

Source

Repository https://github.com/stisa/ajax
Homepage https://stisa.space/ajax/
Registry Source nimble_official

README

Ajax

nimble

Basic wrapper for ajax, for the javascript backend of nim

Examples

Generated Docs

Example: Alert the content of a file named test.html

import dom
import ajax

proc makeRequest(url:cstring) =
  var httpRequest = newXMLHttpRequest()

  if httpRequest.isNil:
    window.alert("Giving up :( Cannot create an XMLHTTP instance")
    return
  proc alertContents(e:Event) =
    if httpRequest.readyState == rsDONE:
      if httpRequest.status == 200:
        window.alert(httpRequest.responseText)
      else:
        window.alert("There was a problem with the request.")
  httpRequest.onreadystatechange = alertContents
  httpRequest.open("GET", url);
  httpRequest.send();

document.getElementById("ajaxButton").onclick = proc(e:Event) =
  makeRequest("test.html")