Comments (13)
@mikaspell The way i can see here you are trying to use the module inside Node.js environment not the browser. In that case you should use something like got or request
from ajax.
Hey @mikaspell! headers
should be passed on ajax
method, and data
should be just an object. Refactoring your code, it will look like this:
const ajax = require('@fdaciuk/ajax')
// configuration for your request
const aQuery = ajax({
baseUrl: 'https://some-site/api/',
headers: { 'content-type': null }
})
// now, make the request
aQuery.post('/user/nop', {
password: res.dataValues.password,
username: res.dataValues.username
})
Let me know if it helped you =)
from ajax.
@fdaciuk unfortunately it did not help
from ajax.
Are you trying this locally?
from ajax.
yes
from ajax.
Which browser are you using?
from ajax.
trace:
Unhandled rejection ReferenceError: XMLHttpRequest is not defined at n (/Users/MikaSpell/Documents/Git/ihstr/node_modules/@fdaciuk/ajax/dist/ajax.min.js:9:570) at Object.r.(anonymous function) [as post] (/Users/MikaSpell/Documents/Git/ihstr/node_modules/@fdaciuk/ajax/dist/ajax.min.js:9:378) at db.define.hooks.afterValidate (/Users/MikaSpell/Documents/Git/ihstr/app/models/User.js:50:14) at /Users/MikaSpell/Documents/Git/ihstr/node_modules/sequelize/lib/hooks.js:141:19 at tryCatcher (/Users/MikaSpell/Documents/Git/ihstr/node_modules/bluebird/js/release/util.js:16:23) at Object.gotValue (/Users/MikaSpell/Documents/Git/ihstr/node_modules/bluebird/js/release/reduce.js:145:18) at Object.gotAccum (/Users/MikaSpell/Documents/Git/ihstr/node_modules/bluebird/js/release/reduce.js:134:25) at Object.tryCatcher (/Users/MikaSpell/Documents/Git/ihstr/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/Users/MikaSpell/Documents/Git/ihstr/node_modules/bluebird/js/release/promise.js:502:31) at Promise._settlePromise (/Users/MikaSpell/Documents/Git/ihstr/node_modules/bluebird/js/release/promise.js:559:18) at Promise._settlePromiseCtx (/Users/MikaSpell/Documents/Git/ihstr/node_modules/bluebird/js/release/promise.js:596:10) at Async._drainQueue (/Users/MikaSpell/Documents/Git/ihstr/node_modules/bluebird/js/release/async.js:143:12) at Async._drainQueues (/Users/MikaSpell/Documents/Git/ihstr/node_modules/bluebird/js/release/async.js:148:10) at Immediate.Async.drainQueues [as _onImmediate] (/Users/MikaSpell/Documents/Git/ihstr/node_modules/bluebird/js/release/async.js:17:14) at processImmediate [as _immediateCallback] (timers.js:383:17)
i use Chrome
from ajax.
here the problem is not likely to form in the request, and in that it requests a module that is mounted
from ajax.
Yes.. really weird. Can you show me all your code? Is it on GitHub?
from ajax.
@fdaciuk yeap
from ajax.
@mikaspell , ajax
library does not work on server side. Please, use some library recommended by @luanmuniz above =)
from ajax.
@luanmuniz thank you! and @fdaciuk sorry for distracts you
from ajax.
No problem @mikaspell =)
from ajax.
Related Issues (20)
- Support to withCredentials HOT 1
- Add jsonp method HOT 2
- Add non-minified source on NPM HOT 1
- "Promise" api is not a proper thenable HOT 1
- mothed "GET" no param request. HOT 1
- Get HTML data HOT 1
- Missing character causes error HOT 7
- Add PATCH support HOT 5
- Call blocked: Origin 'null' is therefore not allowed access HOT 1
- Use fetch with XMLHttpRequest fallback? HOT 3
- Browser logos are broken on README HOT 1
- add 'get' data support HOT 1
- Posso trocar o ajaxForm() do jQuery por essa lib? HOT 2
- Send [object object] from method PUT HOT 4
- ES6 / ES2015 module import HOT 1
- Shouldn't 2.3.1 be a new minor version? HOT 3
- Is this ajax use cache? HOT 1
- Error when using method options HOT 4
- content-type: x-www-form-urlencoded error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ajax.