Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var $ = require('jquery'),
- XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
- $.support.cors = true;
- $.ajaxSettings.xhr = function() {
- return new XMLHttpRequest();
- };
- var najax = require('najax');
- najax('http://www.google.com', function(html){ console.log(html); });
- najax('http://www.google.com', { type:'POST' }, function(html){ console.log(html); });
- najax({ url:'http://www.google.com', type:'POST', success: function(html){ console.log(html); });
- najax({ url:'http://www.google.com', type:'POST' }).success(function(resp){}).error(function(err){});
- najax.get, najax.post, najax.put, najax.delete...
- if (typeof window === 'undefined') { // Running in NodeJS
- var domino=require('domino');
- var $=require('jquery')(domino.createWindow());
- var XMLHttpRequest=require('xmlhttprequest').XMLHttpRequest;
- $.support.cors=true; // cross domain
- $.ajaxSettings.xhr=function(){return new XMLHttpRequest();};
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement