A small AJAX-performing script.
Back when I was creating my PHP-based Hangman game, I needed a way to perform an AJAX request to the backend. Because the assignment forbid using jQuery, I fell back to "plain old" vanilla JavaScript. Wanting to keep my code clean and well organized, I split off the AJAX-performing code into a separate file.
Since then, multiple times I have reused the script each time I needed to perform an AJAX request. I finally became tired of remembering where I put the script on my computer or having to redownload it. That is why I created this repo and posted it here. Who knows, maybe it will come in handy for you too.
- Load onto your site
<script src="microajax.min.js"</script>
- Call
microAjax()
, supplying the requiredoptions
object.
microAjax({
url: "http://example.com",
method: "GET",
success: /* Successful request callback */,
warning: /* Request warning callback */,
error: /* Request error callback */
});
2015-2016 Caleb Ely