Questions tagged [xmlhttprequest]

XMLHttpRequest (XHR) is a JavaScript object that exposes an API for making asynchronous HTTP requests from frontend code running a Web browser — that is, for enabling the programming technique known as AJAX. The XHR API is a legacy API. It has been superseded by the Fetch API.

Example usage

function reqListener () {
      console.log(this.responseText);
}
    
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
oReq.open("GET", "http://www.example.org/example.txt");
oReq.send();

Taken from mozilla.org.

See also

12041 questions
3
votes
0 answers

Web Services in VBA using MSXML.ServerXMLHTTP on Mac

I have an Add-In for Excel that, at one point, I need to send and receive data via Web Services using the Microsoft XML DLLs. The problem is that now I need to make this Add-in available for Mac. Right from the outset I came across a problem,…
Dennys Lopes
  • 49
  • 1
  • 4
3
votes
1 answer

Extracting fragment of audio from a url and play it with pure Web Audio API

On the following url: https://www.tophtml.com/snl/15.mp3 there is one audio I want to play using pure Web Audio API on the following range: range from: second: 306.6 range to: second: 311.8 total: 5.2 seconds I downloaded that file to my…
davidesp
  • 3,743
  • 10
  • 39
  • 77
3
votes
1 answer

Node.js download and execute external script

I am building a simple http client using Node.js. I wonder how to execute a JS script downloaded from a Web server (browser mimicking): my JS code - already tested on FF3.6 - contains both Web Workers and XMLHttpRequest Level 2. Is Node.js…
ziu
  • 2,634
  • 2
  • 24
  • 39
3
votes
0 answers

Is there Canceled status at all for XHR requests made in IE and Edge?

Here is a sample JavaScript code which is aborting a long-running call after 1 second (the test endpoint got 3 seconds sleep in it) function reqListener() { console.log(this.responseText); } var oReq = new…
3
votes
3 answers

GET request from browser works to download file to local but XMLHttpRequest Javascript script does not download file

I'm having trouble with XMLHttpRequest I think, when I navigate to localhost/dashboard/downloadfile?file-name=hw3.txt the file downloads locally but If I use the function checkDownload() to start an XMLHttpRequest the file does not get…
jschelling
  • 41
  • 1
  • 6
3
votes
2 answers

How to handle sent data to server in express?

I am sending this post request from my index.js to my app.js (on a click event): var data = { name: "Sarah", age: "21" }; var xhr = new XMLHttpRequest(); xhr.open("POST", "/", true); xhr.setRequestHeader('Content-Type',…
catandmouse
  • 11,309
  • 23
  • 92
  • 150
3
votes
3 answers

Handling chunked JSON on progress event?

I have a server request which may return a huge json list (~100K records, ~50 Mb) of points I have to draw on a canvas using D3js. I'd like to draw them as they arrive in order to favor interactivity and spare memory, So : I enabled Chunked transfer…
Dr. Goulu
  • 580
  • 7
  • 21
3
votes
2 answers

JavaScript: don't unload document until HttpRequest is complete

I need to make sure that when someone reloads or closes my page, their progress is saved. To save progress, I do a POST via XMLHttpRequest(), sending the data to server. I'm triggering this saveData() function inside a window.onbeforeunload…
Spectraljump
  • 4,189
  • 10
  • 40
  • 55
3
votes
1 answer

What's the difference between a 200 and a 200 OK in chrome?

I am not seeing 200 OK status code next to some of my XHR GET requests in the chrome network logs. Only 200 without the OK. What does this mean and what are the implications? notice the 200 statuses with no OK Has anyone else faced this issue? I…
3
votes
0 answers

Unable to Consume Webflux Streaming Response in React-Native client

I've a reactive streaming api built on spring 5 webflux running on netty server with the following syntax - @RequestMapping(path = "/customer/messages/stream", method = RequestMethod.POST, produces = MediaType.APPLICATION_STREAM_JSON_VALUE) public…
Priyanshu Sekhar
  • 665
  • 6
  • 12
3
votes
1 answer

HTTP Auth request fails in browser due to CORS, ok in Node

I'm stuck trying to diagnose a problem where a GET request with HTTP Basic Auth succeeds in Node, but fails in the browser. The problem manifests directly as a CORS failure (there's no Access-Control-Allow-Origin on the 401 page). request.js:119…
Steve Bennett
  • 114,604
  • 39
  • 168
  • 219
3
votes
1 answer

Why don't apollo-client's GraphQL queries appear in Chrome's XHR Network filter?

I'm using apollo-client, and I've just noticed that my GraphQL queries don't appear on the list of Network calls when the XHR filter is active. How is this possible? GQL is just a set of semantics on top of regular old HTTP, right? It's not like a…
Tom
  • 8,509
  • 7
  • 49
  • 78
3
votes
2 answers

Setting an API key as a header for a XMLHttpRequest

Attempting to work with a Fortnite API (https://fortnitetracker.com/site-api) and it requires me to pass the API key in the header along with my requests. I've tried using .setRequestHeader but haven't had any luck. function getInfo(){ var…
3
votes
1 answer

Make AJAX call wait for event in php

I do not know if my tile line is clear enough... My problem is: I have a JS application that needs to wait for an event on the server. At the moment it polls continuous the server data via XMLHttpRequest every second. What I am thinking about is: Is…
Simon
  • 4,395
  • 8
  • 33
  • 50
3
votes
1 answer

Making a simple POST request with the pastebin API

I was wondering how I would be able to make a post request to pastebin.com. They have an easy to understand API documentation, but whenever I run a simple POST request I always get Bad API request, invalid api_option. I'm using the bear minimum…
Andrew
  • 531
  • 1
  • 6
  • 20
1 2 3
99
100