Skip to content

Instantly share code, notes, and snippets.

@souparno
souparno / cors.js
Created July 21, 2014 13:18 — forked from eriwen/cors.js
/**
* Make a X-Domain request to url and callback.
*
* @param url {String}
* @param method {String} HTTP verb ('GET', 'POST', 'DELETE', etc.)
* @param data {String} request body
* @param callback {Function} to callback on completion
* @param errback {Function} to callback on error
*/
function xdr(url, method, data, callback, errback) {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Building a router</title>
<script>
// Put John's template engine code here...
(function () {
// A hash to store our routes: