FAQ Database Discussion Community


xmlhttprequest request sent, but code not executed?

javascript,php,xmlhttprequest
So, I am using a jQuery Upload-Script i've downloaded on the WWW. This is my JavaScript code: $(document).ready(function() { var settings = { url: "upload.php", method: "POST", allowedTypes:"pdf,xls,doc,docx,xlsx", fileName: "name", multiple: true, onSuccess:function(files,data,xhr) { $("#status").html("<font color='green'>Upload is successed</font>"); }, onError: function(files,status,errMsg) { $("#status").html("<font color='red'>Upload is failed: " + errMsg +...

HTTP Post Request to web service . ERROR : Index was outside the bounds of the array

c#,multithreading,.net-4.0,xmlhttprequest
I have the following code for posting multiple HTTP Post requests to a web service from XML files. The problem here is if I put thread.Join() in the place where it is commented , I am able to put all the requests successfully . But if i use the second...

Comet streaming: XHR streaming and Forever iFrame still possible in 2015?

iframe,xmlhttprequest,streaming,comet
I know I should probably use WebSockets or Server-Side Events, but what happened to the Comet Streaming techniques that involved writing chunked data from a server to either an iFrame or as a response to a xmlHttpRequest? I have stumbled upon multiple demos but none of them work as intended...

How to keep scope within an XHR request?

javascript,routing,scope,xmlhttprequest
So I am building a Javascript router and building a route like this: route('/user/{name}', 'page', function() { this.text = 'User: ' + this.name; }); The scope of the function is the current route, so I can manipulate the current route here (this.text is what the view is looking for). Now...

How to make POST request in my app

javascript,angularjs,resources,xmlhttprequest
I am trying to use $resource to make post request. In my app, angular.module('myApp').factory('Product', ['$resource', function ($resource) { return $resource( '/api/product/:id', { id: '@id' }, { 'save': { method: 'POST', isArray: true, url: '/api/product/:id/addProduct' //different url for adding a product. ,} } ); } ]); In my controller Product.save({ name:'test...

Uncaught TypeError: Cannot read property '0' of undefined

javascript,jquery,json,xmlhttprequest
here is my script : <script> var count; var obj; function recherche() { xhr = new XMLHttpRequest(); xhr.open("GET", "test.json", true); xhr.send(null); xhr.onreadystatechange = function() { if (xhr.readyState == 4 && xhr.status == 200) { var res = xhr.responseText; obj = JSON.parse(res); for (count = 0; count < obj.length; count++) {...

Upload pictures to the server which resizes them and compresses, and finally sends the result to the origin CDN? [closed]

javascript,node.js,image-processing,xmlhttprequest,image-uploading
I'm having an app where users can have their gallery pictures. Now, I want to allow users to choose an image through an <input type="file">, then through an XHR/multiple XHRs, upload it to the server (a node.js server which uses express.js), which will resize the image to a custom size,...

Scrapy crawler not processing XHR Request

python,web-scraping,xmlhttprequest,scrapy,scrape
My spider is only crawling the first 10 pages, so I am assuming it is not entering the load more button though the Request. I am scraping this website: http://www.t3.com/reviews. My spider code: import scrapy from scrapy.conf import settings from scrapy.http import Request from scrapy.selector import Selector from reviews.items import...

Change Response from HTTP Request sent by a program

networking,http-headers,xmlhttprequest,fiddler,packet-sniffers
I have a program that activate an chip for racing results. (Its just a piece of hardware). I watch with Fiddler (Sniffing program) the in and outgoing traffic from my pc when I connect the chip with my computer. The program sends the following HTTP Request: POST http://example.com/index.php HTTP/1.1 Accept:...

ExpressJS : req is undefined

javascript,node.js,post,express,xmlhttprequest
I try to post data with XMLHttpRequest to a service made with ExpressJS. Server side in index.js : app.post('/add',url.add); Servier side in url.js : exports.add = function(req, res){ var urlToAdd = req.body; console.log(urlToAdd); }; Client side : <input id="url" required="true"/> <button id="addButton">Ajouter</button> JS Client side : document.getElementById("addButton").addEventListener("click",function(){ var url =...

Multiple onprogress event handlers from xhr in loop

javascript,html5,xmlhttprequest
I'm currently trying to build an ajax image uploader and I have it working except for one important part. For each separate file I upload I would like to update a progress bar for the file. Currently it only updates the last files progress bar. $("#upload-btn").click(function() { console.log("Click"); for (var...

How to send a JSON data object to the server using Javascript XMLHttpRequest?

javascript,php,ajax,json,xmlhttprequest
I send an XMLHttp Request to a PHP server. I cannot get hte $_POST or $_REQUEST object filled with the data I send using Javascript: var r = new XMLHttpRequest; r.open("POST", "http://url.com", true); r.send({ myname : 'someName'}); I cannot access myname property in the $_POST array, though I see in...

When Promisifying a XMLHttpRequest, how to catch a throw Error

javascript,xmlhttprequest,promise
After I've Promisified my XMLHttpRequest, like so: var Request = (function() { var get = function(url){ return request('GET', url); }, post = function(url){ return request('POST', url); }, request = function(method, url) { return new Promise(function (resolve, reject) { var xhr = new XMLHttpRequest(); xhr.open(method, url); xhr.onload = function(e){ if (xhr.status...

error: Bad content type. Please use multipart

javascript,angularjs,file-upload,xmlhttprequest,google-cloud-storage
I'm totally new to file uploads....I'm using angular-file-upload which creates an XHR outside of angularjs to upload files to google cloud storage. When I try to upload I keep getting the error below. How can I resolve this? 400 Bad content type. Please use multipart. Here's my controller setup: var...

Maximum amount of simultaneous xhr requests?

javascript,xmlhttprequest
I am making a small web app that allows the user to drag a slider to show different content. Each time the slider is moved, the client uses the HTML5 Geolocation to get its position and then sends a XMLHttpRequest to the server for new content. The problem is if...

(CORS) How does the browser know when to do a pre-flight request

javascript,rest,dom,xmlhttprequest,cors
So I have been using CORS for a short time now, I just read up on how it works behind the scenes. My question is how does the browser know when to do a pre-flight request? There is no issue involved right now, as the browser seems to be working...

Override incorrect declared text encoding in XML document using XMLHttpRequest

internet-explorer,character-encoding,xmlhttprequest,windows-1252
Our app is receiving data from a source with incorrect XML headers. Although the workaround in that post works (inserting an nginx proxy), we'd like to find a client-side solution, if there is one. So, is there a way to intercept an XML document and force the document to be...

How to beautify respond body of XHR (Ajax call) in Chrome browser?

ajax,google-chrome,google-chrome-extension,xmlhttprequest,google-chrome-devtools
As can be seen in the screencast below, the respond body is a minified JSON object.. Does anyone have ideas about how to beautify it in Google Chrome Browser? ...

IE8 changing GET request to POST: Angular $http

javascript,angularjs,http,internet-explorer-8,xmlhttprequest
I am making call to a REST service from my AngularJS app using $http. The issue is whenever I make a GET request from IE8, it gets converted to POST request. Calls with other http methods (POST,PUT) work fine. This happens only with IE8. Here is my code ``` var...

Simple XMLHttpRequest function to return a JSON object

javascript,jquery,json,xmlhttprequest
I'm trying to return a json object following an XMLHttpRequest get request, and I come up short. I think that might be because it is asynchronous, but I really can't put my finger on how to make it work. What am I doing wrong? $(document).ready(function() { var apiEndpoint = 'http://someapiendpoint.com/'...

Unable to override XMLHttpRequest using pageMod (Firefox addon)

javascript,firefox,xmlhttprequest,firefox-addon
I have some troubles trying to override the XMLHttpRequest from a Firefox addon context. The reason why I want to override this function is that I want to know when a certain request is made in order to fire one of my event. The main.js I am currently using: pageMod.PageMod({...

Will a cross site XMLHTTPRequest ever re-use credentials?

javascript,xmlhttprequest,csrf,http-basic-authentication
There is an open source daemon that has a JSON API. This daemon forces the use of basic HTTP authentication. I'm considering submitting a PR to always send the Access-Control-Allow-Origin: * header to allow the API to be consumed by other webpages, but I want to ensure it doesn't present...

'Access is denied' error for HTTP get request in Adobe Air App using IE

angularjs,internet-explorer,webview,air,xmlhttprequest
I have an angularjs application that runs in a webview that is meant for a Windows Surface device (I am also using IE 11 instead of Adobe AIR webkit). I want to load a local XML file from the app and I am using $http.get() for that. The request is...

unable to set xhr.responseType using chrome 43 beta

javascript,google-chrome,xmlhttprequest,chromium
I have some request that I'm sending the server, and I'm setting the XMLHttpRequest object I created as follows: var xhr = new XMLHttpRequest(); xhr.responseType = "blob"; This works just fine on the current chrome 42 version, but when I try to run the same code on chrome 43 beta,...

How to pass a parameter to CanvasJS returned from XMLHttpRequest?

javascript,ajax,json,xmlhttprequest,html5-canvas
I took an example code from : http://canvasjs.com/html5-javascript-bar-chart/ ("Cost of pancake.."). When running it, it works of course. I created a small html that when entering a url, it returns me exactly the second parameter that should be passed to : var chart = new CanvasJS.Chart("chartContainer",my_parameter); code : <!DOCTYPE html>...

XMLHttpRequest() is not working in Firefox.

firefox,xmlhttprequest
I don't know why XMLHttpRequest() is not working in Firefox. Works in Chrome and IE. This code is about change the language of my website. <script type="text/javascript"> $(document).ready(function(){ $("#idioma_ingles").click(function(){ xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "?idioma=2", true); xmlhttp.send(); location.reload(); }); $("#idioma_espanol").click(function(){ xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "?idioma=1", true); xmlhttp.send(); location.reload(); });...

Agnostic scheme / protocol ajax call

ajax,http,https,xmlhttprequest,xdomainrequest
I would like to do an ajax call that adapts to current scheme (http/https). What would be a really valid approach to this situation (both to xhr and xdr)? var xhr = new XMLHttpRequest(); // Or var xdr = new XDomainRequest ... xhr.open("get", "//mydomain.com/api/v1/etc", true); ... Or var xhr =...

is binary file(pdf, word, excel, ppt, mp3,…) download possible using XHR or fetch?

javascript,html5,browser,download,xmlhttprequest
is binary file(pdf, word, excel, ppt, mp3,...) download possible using XHR or fetch? I have seen some snippets and tricks for pdf and images using data URI and base64 conversion. Do we have some better mechanism available? I need to download a file with following constraints: File download request must...

Make use of unnamed array

javascript,json,xmlhttprequest
I am calling an API and successfully getting back an array like this: [ { "absmag" : "4.85", "speed" : "0", "colorb_v" : "0.65", "label" : "Sun", "appmag" : "-26.72", "distance_light_years" : "0", "id" : "53794", "hipnum" : "0", "vy" : "0", "updated_at" : "49:09.3", "vx" : "0", "vz" :...

XMLHttpRequest can't sent unicode chararcter as request header

javascript,html,xmlhttprequest
I want to send an XMLHttpRequest via JavaScript and Everything work fine. But when i try to send a Persian string instead of English i got this error: TypeError: Cannot convert string to ByteString because the character at index 0 has value 1587 which is greater than 255. Note that...

“Synchronous XMLHttpRequest on the main thread is deprecated” using nodejs app.get or http-server

node.js,express,xmlhttprequest,synchronous,http-server
I am creating a front end in AngularJS for a backend in node.js. I have the option of two simple node.js front end servers to serve the front end web page: one is a simple app.get in express, the other is using the http-server package. Whichever front end server code...

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience

javascript,asynchronous,xmlhttprequest
I am loading the content from other local pages using $.load but i get this error in both chrome and firefox. Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience This is my code $(document).on("click", ".menuL", function() { var e =...

Scrapy follow pagination AJAX Request - POST

ajax,post,pagination,xmlhttprequest,scrapy
I am quite new to scrapy and have build a few spiders. I am trying to scrape reviews from this page. My spider so far crawls the first page and scrape those items, but when it comes to pagination it does not follow links. I know this happens because it...

d3.xhr - handling successful empty response

d3.js,xmlhttprequest
I am making an XHR request with D3: d3.json('/api/A').post('...').on('load', onLoad) However, onLoad is never called. The reply is 200 Ok, Content-Type is application/json, body is empty. I suspect that can make a difference as otherwise similar calls work and call the 'load' handler function. Question is: How to handle this...

Javascript return after XMLHTTPRequest()

javascript,xmlhttprequest
I have this problem, so I want to return the value received after an XMLHTTPRequest(), is this possible? If not, how would I go about achieving the same general idea? Here's what I have so far (It is obviously not working). function something(url) { var temp = getPage(url); console.log(temp); }...

Can CDNs handle base64 encoded data?

image-processing,upload,xmlhttprequest,base64,cdn
I'm trying to make an app where I take pictures from users add them to a canvas, draw stuff in them, then convert them to a base64 string and upload them. For this purpose I'm considering the possibility to use a cdn but can't find information on what I can...

Multipart file upload with Spring: NoSuchMethodException: …CommonsMultipartFile.()

java,spring,maven,xmlhttprequest
I'm trying to upload images using javascript's XMLHttpRequest object, but Spring keeps throwing a NoSuchMethodException. The exception is as follows: java.lang.NoSuchMethodException: org.springframework.web.multipart.commons.CommonsMultipartFile.<init>() at java.lang.Class.getConstructor0(Class.java:2892) at java.lang.Class.getDeclaredConstructor(Class.java:2058) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104) at...

How i can doing for call a object with a dot in middle, for example parsing one xml to php?

php,codeigniter,xml-parsing,xmlhttprequest
I need parse a response xml in php, and i call the object into object, but one object have a "." or "-" in middle. For example xml : [obj1] [obj1.1] Array( [value]xxxxxx ..... In php i trying : $myvalue = $xml->obj1->obj1.1['value']; echo $myvalue; And need a function or method...

How to reuse JSON data that may have changed?

javascript,json,d3.js,xmlhttprequest
I have a force directed graph and I want to be able to click buttons to change the JSON file used to present the graph. I have a simplified version of what I have here in JSFiddle : Go to line 374 to go to the JS and skip the...

Undefined $_POST after xmlhttp request

javascript,php,mysql,ajax,xmlhttprequest
My code makes an xmlhttp request to a php file, sending an ID so that a record can be identified and deleted from the database. However, when performing the delete query, I'm get an error saying 'comicID' is undefined (the variable using the ID value sent by POST). I'm not...

XMLHttpRequest throwing InvalidSateError saying “Object state must be opened”

javascript,ajax,xmlhttprequest
The code - "use strict"; var AJAX = function (params) { this.server ={}; this.url = params.url; this.method = params.method; this.dataType = params.dataType; this.formData = params.formData; this.init = function(){ if(typeof XMLHttpRequest != 'undefined'){ this.server = new XMLHttpRequest(); this.server.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); this.server.setRequestHeader('Content-length', this.formData.length); this.server.setRequestHeader('Connection', 'close'); console.log("XMLHttpRequest created.");...

Apiary Invalid Header

javascript,xmlhttprequest,apiary.io,apiary
Im trying to send a request to the apiary API and the header is always invalid. The API expect charset as 'utf-8' which is correctly set in the code. At the inspector of the api website you can see that the request hast set charset as UTF-8... Why is the...

when will callback for synchronous xmlHttpRequest calls get executed?

javascript,xmlhttprequest
Here is my sample code. (The reason I need to send synchronous requests is that actually I need to send several requests and each requests depends on the previous request's response. And the reason I need to set callbacks is that I want to show some spinner, so users knows...

How do I promisify native XHR?

javascript,xmlhttprequest,promise
I want to use (native) promises in my frontend app to perform XHR request but without all the tomfoolery of a massive framework. I want my xhr to return a promise but this doesn't work (giving me: Uncaught TypeError: Promise resolver undefined is not a function) function makeXHRRequest (method, url,...

Edit and replay XHR chrome/firefox etc?

google-chrome,firefox,browser,xmlhttprequest
I've been looking for a way to alter a XHR request made in my browser and then replay it again. Say I have a complete POST request done in my browser, and the only thing I want to change is a small value and then play it again. This would...

Double issue with “this” scope in xmlhttprequest javascript

javascript,ajax,asynchronous,callback,xmlhttprequest
I have two huge issues with this scope in my javascript code. After creating setAJAXGet object, callback function was lost and couldn't be called correctly. So instead of calling this.funct I set ajax.parent = this; and call this.parent.funct - works ok. function setAJAXGet() { this.askServer = function() { var ajax...

XMLHttpRequest to Restivus API

javascript,meteor,xmlhttprequest,cross-domain,cors
I have got a problem when sending a cross domain XMLHttpRequest to a Restivus API. Here my code for the client side script: var xhrurl = 'http://example.com:3000/api/test'; var xhr = createCORSRequest('POST', xhrurl); xhr.withCredentials = true; xhr.setRequestHeader("Content-type","application/json"); xhr.setRequestHeader("X-User-Id",object.apiUser); xhr.setRequestHeader("X-Auth-Token",object.apiKey); xhr.send(); Here the function createCORSRequest function createCORSRequest(method, url) { var xhr =...

Is there a way to get the progress info when download file/web page in XMLHttpRequest

javascript,xmlhttprequest
the cpde below is to download web page from yahoo.com homepage var http = new XMLHttpRequest() var url = "http://yahoo.com:8080"; var params = ""; http.open("GET", url, true); // Send the proper header information along with the request http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = function() { // Call a...

JavaScript: XMLHttpRequest() from Firefox addon to get zip

javascript,firefox,xmlhttprequest,firefox-addon,zip
I am trying to build a Firefox addon to request a zip file from a webpage and store it locally/decompress. I receive a 200 response code when I request the zip as a Blob type, but I am unsure how to store it since the Firefox file I/O documentation is...

Firefox SDK Error “Image contains errors and cannot be displayed”

javascript,image,firefox,xmlhttprequest,add-on
I am developing an extension for Mozilla Firefox, where I override the native listener with my own and monitor all HTTP requests, as shown in the post here: http://www.softwareishard.com/blog/firebug/nsitraceablechannel-intercept-http-traffic/ I monitor those requests that reside under a specific domain and change their corresponding response body, with the response body I...

Access to html basic protected image via SapUI5 & Cordova

android,cordova,xmlhttprequest,basic-authentication,sapui5
I'm trying to access an image protected by a simple http basic authentication mechanism. This example works fine when using my browser ... var mImage = sap.m.Image("Im1"); mImage.setSrc("http://user:[email protected]/image.jpg"); ... var page = new sap.m.Page({ title: "Image", content: mImage } Yet when I wrap it in a Cordova container (Android) this...

Can I use XHR to load a local file (from SD card) on android?

javascript,cordova,xmlhttprequest
I have working js code that loads a bunch of files using XHR. On PC Chrome it just works (with the Chrome flag that allows loading local files) and it also worked on android, if I put the files inside the apk. However those files are huge and having phonegap...

Read/Write the cookies from an XHR request/response (PhoneGap/Cordova)

cordova,http,cookies,xmlhttprequest,phonegap-plugins
I am using $http (angular) and posting to a distant website which I don't control. When logging in, it gives me a 'site_session' cookie which I want to read. Please note that I am able to call a remote website (cross-domain) because running on a mobile device, in a Cordova...

Make a HTTP request in your Controller - sails.js

javascript,node.js,xmlhttprequest,sails.js
Is it possible to make a request in the controller? I have tried using the node.js http module but didn't have any succes. Is there any other method to do this?

Server-side requests and XmlHTTPRequest (client-side) and security

javascript,security,xmlhttprequest,cross-domain,same-origin-policy
I was wondering about the following: When I make an XmlHTTPrequest to a external source outside my domain it will fail when there is a conflict with the same-origin-policy. This is due to security reasons. The code I wrote will be executed on a client's PC, which has restrictions. However...

Uploading GPX file to Strava API with GTMHTTPFetcher POST in Objective-c

ios,objective-c,http,post,xmlhttprequest
After exploring the use of the Strava API (http://strava.github.io/api/v3) with GTMHTTPFetcher for 2 days I am now completely stuck at uploading a .gpx file to my account so I made the decision to ask for an answer here. I successfully received and stored an access token with the necessary 'view_private,write'...

Displaying table from PHP in HTML through AJAX

javascript,php,html,ajax,xmlhttprequest
I am trying to display a table from my PHP file on a web page which is the index.html file using ajax. I am new to PHP and ajax so I currently do not know what is wrong with the codes. However what I do know is that there data...

Why does my XMLHttpRequest not allow XSS?

javascript,xmlhttprequest,client,cors,xss
I am writing a simple app to pull down news stories from the bbc rss feed at http://feeds.bbci.co.uk/news/rss.xml. It needs to run entirely on the client and not make use of jQuery, so JSONP is not a possible solution. I have been testing with IE on localhost and clicking the...

Angular JS : Failed to execute 'send' on 'XMLHttpRequest'

angularjs,xmlhttprequest
I am trting to read a json file through Angular's built-in services called $http.But, the page gives me an error saying "Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load respective json file". Here's my code: angularExample.html <!DOCTYPE html> <html ng-app="Fino"> <head> <link rel="stylesheet" type="text/css" href="scripts/bootstrap.min.css" /> <script type="text/javascript"...

CORS issue with asynchronously loaded JavaScript through dynamically created script tags

javascript,html,ajax,xmlhttprequest,cors
Creating a script dynamically like below will download the JavaScript source asynchronously. var script = document.createElement('script'); script.src = src_url; var first_script = document.getElementsByTagName('script')[0]; first_script.parentNode.insertBefore(script, first_script); What type of request object is created under the hood ? XMLHttpRequest objects are used for asynchronous data exchange with AJAX. Is it the same...

Why does the jquery ajax documentation mean when it says “For backward compatibility with XMLHttpRequest”

jquery,ajax,xmlhttprequest,jqxhr
I'm looking at the documentation for the current version (1.11.2) of jQuery's ajax method. It prefaces the explanation of the jqXHR object with the following line: For backward compatibility with XMLHttpRequest, a jqXHR object will expose the following properties and methods: Why is this "backwards compatibility"? Is XMLHttpRequest deprecated? And...

always_populate_raw_post_data - Trouble accessing request payload from Backbone create

php,backbone.js,xmlhttprequest,slim,postdata
I am trying to save a collection to my database RESTfully using Backbone.js with the SLIM php framework running on my server. Here is my collection: var newUser = this.collection.create( formData, { wait: true, success: $.proxy(function() { this.collection.currentUser = newUser; App.Router.navigate('', { trigger: true }); }, this) } ); Here...

How do you use pdf.js to get text content of client stored pdf?

javascript,xmlhttprequest,pdf.js
I am working on a web app that needs to read a pdf with pdf.js. I have a file input on my page that chooses the file. I have the document.getElementById("...").value as the pdf's url. When I run it, it says: "XMLHttpRequest cannot load c:\fakepath\vocab_list_15_8th_grade.pdf. Cross origin requests are only...

Javascript: Sending arrayBuffer using XMLHttpRequest

javascript,xmlhttprequest,multipartform-data,arraybuffer
I want to send a multipart form using XMLHttpRequest. The file I want to attach is a jpg file. Appending the file to the FormData object works fine. But I'd like to process the image file before sending it. Therefore I have a library that takes a Uint8Array as input...

Why I'm not entering into sucess event of $.ajax request [closed]

jquery,ajax,xmlhttprequest,sendasynchronousrequest
I'm new to this concept and working around with some basic examples to understand the asynchronous calls $(document).ready(function () { $('#btnLoadData').click(function () { $.ajax({ url: 'dummy.html', dataType: 'html', sucess: function (result) { alert("into sucess"); $('#para').innerHtml = result; }, error: function () { alert("error while sending a request") }, complete: function...

Firefox addon - how to use XMLHttpRequest in Chromeworker?

ajax,xmlhttprequest,firefox-addon
I am using ChromeWorker to download some data from a API. I am trying to import XHR in myWorker.js. importScripts("resource://gre/modules/workers/require.js"); var { XMLHttpRequest } = require("sdk/net/xhr"); I am getting the following error while running cfx run Error: TypeError: The argument to require() must be a string uri, got sdk/net/xhr I...

XMLHttprequest not working the twitch.tv api

javascript,api,xmlhttprequest,twitch
So I've been trying to access the twitch.tv api but every time i go to make a request i keep on getting the error: "XMLHttpRequest cannot load https://api.twitch.tv/kraken/streams/normalice. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8080' is therefore not allowed access." I'm currently using the live-server package...

Why can Chrome get file, but not Safari?

node.js,http,web,safari,xmlhttprequest
The URL Open this url in Chrome is all fine, but when open it in Safari, some files can't get forever. OK in Chrome: BAD in Safari: As you can see, all plist file and ExportJson file can't get in Safari. But they all exists in server. Like faceshow_10.plist, it's...

Ajax / XMLHttpRequest tracking using javascript

javascript,html,ajax,xmlhttprequest,trace
I know firebug can trace all the Ajax/XHR events on a page. But I need to prepare a tool which automatically tracks these calls on button clicks on an already existing webpage. My webpage's HTML and JS structure are follows: HTML: <a href="javascript:void(0)" id="callButton" class=" call-btn " style="width: 30px;">Call</a> JS:...

On slow network previous Ajax request gets cancelled by the subsequent

javascript,ajax,xmlhttprequest
I have the following problem: I'm trying to send two Ajax requests almosts simulateously: function ajax() { xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if(xhr.readyState == 4) console.log(xhr.responseText); } xhr.open('GET', 'list.html', true); xhr.send(''); } ajax(); ajax(); The problem is that only one of them succeeds. And if I try...

Getting Json data from text file in AngularJS

javascript,json,angularjs,text,xmlhttprequest
I am new to AngularJS and trying to fetch JSON data from a text file: Here is my HTML: <div ng-controller="customersController as custCont"> <ul> <li ng-repeat="x in names"> {{ x.Name + ', ' + x.Country }} </li> </ul> </div> Whereas my controller is as given below: app.controller( "customersController", function( $scope,...

AWS API signed POST request with Javascript

javascript,amazon-web-services,http-headers,xmlhttprequest,amazon-kinesis
What I'm trying to do: Ultimately: I want to populate an AWS Kinesis stream from a browser extension (Safari, Chrome). I need to send the request to AWS using a signing process (v4); this involves setting headers and encrypting them (on a distant server with the aws secret key) to...

PHP returns JSON fine but JavaScript shows it is undefined in onload function

javascript,php,json,xmlhttprequest,undefined
I can't figure out how to solve this problem so I'm asking you to help me with it. I'm trying to parse RSS feed to JSON, but due to XSS problems it can't be done with JS (I'm not using jQuery so don't recommend me plugins). I thought I'll do...

Busboy doesn't fire 'field' event

angularjs,node.js,xmlhttprequest,busboy
I get the file event of the formData but busboy doesn't fire the other field event. Can someone take a look? I'm using the newest version of node and busboy. The formData is posted via xmlhttprequest. I want to add some other fields than just the file. Busboy: var Busboy...

Ruby on Rails: output JSON data from array

html,ruby-on-rails,ruby,json,xmlhttprequest
I have a webpage in which a javascript code requests JSON data from a remote URL using XMLHTTPRequest(). The URL is served by a Ruby on Rails app. I tried to print an hardcoded JSON string from a test view but it get wrapped around HTML tags (html, head, body...

How to update url via javascript in the XMLHTTPRequest

javascript,xmlhttprequest
I'm trying to update the URL inside my javascript function e.g. http://tmaserv.scem.uws.edu.au/chapters/?n=0 http://tmaserv.scem.uws.edu.au/chapters/?n=1 and so on. I've tried using a for loop but it hasn't work. Javascript: function do_exercise () { var x = new XMLHttpRequest();{ x.open('GET', 'http://tmaserv.scem.uws.edu.au/chapters/?n=0', true); x.onreadystatechange = function() { if (x.readyState == 4 && x.status ==200)...

npm request vs. XMLHttpRequest for simple GET requests

javascript,node.js,request,xmlhttprequest
Up until now, I've always used the plain old XMLHttpRequest for GET requests, e.g., var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.onload = function() { if (this.status === 200) { // do something } else { // do something else } }; xhr.send(null); I now came across request and...

Google Analytics: XHR instead of pixel-tracking

javascript,google-analytics,xmlhttprequest
By default google analytics use pixel-tracking technology to send statistics to server. I can see a piece of code in analytics.js for new image object generating. ta = function (a) { var b = M[u]("img"); b.width = 1; b.height = 1; b.src = a; return b } But a browser...

ObtaI n url of page which fired ajax request in ajax view

jquery,ajax,django,xmlhttprequest
I have some page /page/< some_id >/. On this page I have form which are sent to some other url /ajaxreq/. Is it possible to read /page/< some_id >/ from request object in /ajaxreq/ view? PS: I know, this is a design issue and there are many other ways to...

Send a POST XMLHttpRequest with a body to an express node server

node.js,http,post,express,xmlhttprequest
Basic background: I have an express node server running a really simple website. The first page of the site has two inputs (1 text, 1 number) <input type="text" name="xml_url" id="xml_in" placeholder="Required" /> <input type="number" min="0" name="c2" id="c2_in" placeholder="Required" /> As of right now really simple, the user inputs a url...

jQuery.ajax() error with textStatus=error

javascript,jquery,ajax,xmlhttprequest
The JQuery ajax() function I use works most of the time correct. However sometimes it is not returning any data. Instead the error() function is called. $.ajax({ [...] , error: function(jqXHR, textStatus, errorThrown) { console.log(jqXHR); console.log(textStatus); console.log(errorThrown); } }); I can see in there that in those cases textStatus is...

Putting additional data to $routeProvider templateUrl request

javascript,angularjs,xmlhttprequest,angularjs-routing,ng-view
I want add to add some headers to the requests for fetching templates so I can reject non-angularjs requests and respond with an error. However it seems that it's only possible using $http and it seems like terrible waste to reimplement a mechanism similar to the one templateUrl provides. Here's...

Multiple XMLHttpRequests At Once

javascript,php,xmlhttprequest
I am building a php uploader and I have this javascript that is rendered for each file selected for upload. var formdata = new FormData(); formdata.append("file1", file); var ajax = new XMLHttpRequest(); ajax.upload.addEventListener("progress", progressHandler, false); ajax.open("POST", "fileUploader.php"); startTime = (new Date()).getTime(); ajax.send(formdata); I want to be able to update a...

XMLHttpRequest returns wrongly encoded characters

javascript,pdf,utf-8,character-encoding,xmlhttprequest
I use XMLHttpRequest to read the PDF document http://www.virtualmechanics.com/support/tutorials-spinner/Simple2.pdf %PDF-1.3 %âãÏÓ [...] and print its content out to console: var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { console.log(xhr.responseText); console.log('âãÏÓ'); } }; xhr.open('GET', 'http://www.virtualmechanics.com/support/tutorials-spinner/Simple2.pdf', true); xhr.send(); However, the console says %PDF-1.3...

IE 10 pending XMLHttpRequest for 6 minutes and then answers the request (CRSF implementation with AngularJS)

javascript,angularjs,security,internet-explorer,xmlhttprequest
Task description I implemented CRSF protection for my angular application. The server checks if the crsf token is placed in the header 'X-CSRF-TOKEN' of the request. If not it sends a http response 403. Ïn my client I intercept all requests and check if a http response 403 is returned....

XMLHttpRequest: How to force caching?

javascript,ajax,caching,xmlhttprequest
I'm newer to XMLHttpRequests since I've previously used jQuery's AjAX method. However I need to work in a web worker and now I have to use the classic XMLHttpRequest for performance issues. I'm trying to rebuild the cache-property from jquery. If cache should be disabled I add this: xhr.setRequestHeader("Cache-Control", "no-cache");...

XHR OnLoad Promise blocking other OnLoad callbacks

javascript,asynchronous,xmlhttprequest,es6-promise
I am trying to download files from my server then run Promises on the loaded data. My issue is that is seems that my Promise are blocking everything for some reason: It start downloading ALL files, once the first file is downloaded, it blocks others download and run its "onLoad"...

Setting CORS call to GET not OPTIONS

javascript,xmlhttprequest,authorization,cors
I am creating a CORS call as follows: createCORSRequest: function(method, url) { var xhr = new XMLHttpRequest(); xhr.withCredentials = true; if ("withCredentials" in xhr) { // Check if the XMLHttpRequest object has a "withCredentials" property. // "withCredentials" only exists on XMLHTTPRequest2 objects. console.log("Sending request with credneitials"); xhr.open(method, url, true); }...

HTTP Post Rails 4 Issue

rest,ruby-on-rails-4,xmlhttprequest,http-post,net-http
Thank you in advance for any and all help. I've been having a ridiculous issue with trying to get my rails 4 app to take in data from an email parsing API that sends an XML response to a specified url within my application. For whatever reason I can't seem...

How check file XML

xml,xsd,xml-parsing,xmlhttprequest,linq-to-xml
I have xml file. I think file is not correct.I check file in validator. I get link: http://validator.w3.org. I get 3 warinngs but document is good. My question is that file correct.Do I must add DOCTYPE. Can you help me.I am green in XML. Can you give me tutorial, books,...

Not able to get Request-scoped attribute in Action through XMLHttpRequest

jquery,ajax,struts2,http-headers,xmlhttprequest
I am setting receiverid in jsp page. I am sending textarea value in action using ajax and on same method I am getting client Ip that is working properly. I also want to get receiverid which is set in jsp page. But this is showing NullPointerException. In jsp <s:set var="receiverid"...

XMLHttpRequest and C CGI…who sends back just one word

javascript,c,xmlhttprequest
I'm making a test with a simple form with a script who takes the value of the text area and sends it to "sample.cgi", now, "sample.cgi" should just send back exactly the text I sent to him...but, I get back only the first word. I can't really find the problem....

Sending xml request to url and receiving xml response back

c#,asp.net-mvc,xmlhttprequest,httpwebrequest
I'm trying to send an xml request to a url and the response will also be an xml response. I know how to call a service endpoint from an MVC application but I'm not sure how to call this url and how to read what it will give me back....

jQuery AJAX dataparam passing issue in Blackberry

jquery,ajax,blackberry,xmlhttprequest
I am using jquery ajax post method to submit form parameters to JAXRS service. $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "http://xyz.in/webservice.asmx/backup_p", data: "{ 'id': '1', 'data': '4' }", dataType: "json", success: function (msg) { alert('sucess !!!'); alert(msg.d); }, error: function (jqXHR, textStatus, errorThrown) { alert('hello'); alert(jqXHR + " :...