xhr

PUT Request not going through - what am i doing wrong?

I have a PUT request (same-domain) done with XHR and it does not get through (on Firebug, the icon loads and i get no data, no response). PUT http://hyveup.net/xvrelation/dev/api/ui/?section=texts&action=add Host hyveup.net User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.8) Gecko/20100723 Linux Mint/9 (Isadora) Fire...

Howto create a AJAX request with JavaScript that contains both file and post data

How can I create a HTTP request that sends one file and some post data with JavaScript that can be received by a PHP server? I have found the following suggestion but it does not seem to be complete xhr.open("POST", "upload.php"); var boundary = '---------------------------'; boundary += Math.floor(Math.random()*32768); boundary += Mat...

Uploading a binary string in WebKit/Chrome using XHR (equivalent to Firefox's sendAsBinary)

I'm working on a webapp that uses several cutting-edge WebKit features. It essentially does this: reads a local file with the FileReader, unzips each file into a string using a JavaScript unzip library, and POSTs each file using XMLHttpRequest. This works great for text files, but unfortunately it corrupts binary files (in this case, ima...

Is it possible for XHR HEAD requests to not follow redirects (301 302)

Is it possible to send an xhr HTTP HEAD request to only get header response for the first request and not automatically follow 301, 302 like redirects? I'm only interested in getting the new location of the url. Example: var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(data) { if (xhr.readyState == 4) { if (...

Socket.IO / Node.JS / Rails 3 / IE

This is a bit complicated but here goes. I have a Rails app that has a small JS widget that gets updated on some backend processing stuff. The Rails app queues up a job in Redis (via Kthxbye) which gets processed and then once completed, fires off a redis publish message. This channel is being watched by a Node.JS server which is respon...

Does an HTTP Status code of 0 have any meaning?

It appears that when you make an XhrHttpRequest from a script in a browser, if the browser is set to work offline or if the network cable is pulled out, the request completes with an error and with status = 0. 0 is not listed among permissible HTTP status codes. What does a status code of 0 mean? Does it mean the same thing across all...

How do I know what went wrong with an XHR request?

I am using mootools to send an XHR request. To a url that in other places I call using XHR is working fine. The server side does what it is suppose to do. But, I do not see any response headers. The onFailure event is being fired and the XHR object is being returned to the event handler. How do I debug this and see any kind of error mess...

How to assign file contents into a Javascript var

ok, this is simple, but I kinda need a noob's help. I'd like to do something simple: To assign an HTML file contents to a JS var, and then to pass this html code into a page element using the innerHTML property. This can be done easily with HtmlHTTPRequest, however, i'm not sure what is the exact code i should use. here's what I'd lik...

Is there a XHR request/response manager for Dojo

I was wondering if Dojo (or any of its extensions) provides a (reliable) XHR request/response manager that would allow me to queue, block and retry calls when needed. Something similar to AJAX Queue/Cache/Abort/Block Manager v. 3.0 for jQuery. ...

How to prevent webkits constant url loading url / throbber of doom

There is a few questions about this, but mostly lacking details and no definitive answer. So I am using xhr long polling, my poll is pretty basic and just looks like var poll = function() { $.get(url, function(data) { doStuff(data); poll(); }); }; I start that from a script that is imported just before , I remove absolu...

How do I get the http return code from an XHR object in mootools

I am doing an AJAX request. In my onFail event of the Request I catch the XHR object. What is the name of the member in this object that holds the code. For that mater, I could not find a documentation that shows the list of members in that object. ...

Jquery get data on XHR error

Hello, If I make a jquery AJAX request which is succesful I get back my JSON data. However, If I make a request and I get somthing other than a 200 response code back, I cannot get back the data in the Jquery call back. I need the data as it has a description about the data. success: function (data, tst, xhr) { $.log('XHR OK'); }, ...

rails asynchronous communication and xhr polling

I need to write a Rails application (JRuby) that does asynchronous communication with another service in the background. There needs to be one connection per browser session. (It does not really need to be a open TCP connection but I need to free resources after the session ends.) The communication with the background service is not stri...

NS_ERROR_NOT_AVAILABLE in GWT DevMode when not on network

My GWT app works fine in DevMode if I am connected to the network. If I disconnect (turn Airport off), my app stops working. The problem occurs when the app makes an XHR request. Googling around suggests that this is related to a Same-Origin Policy violation; but I can't understand why that would occur when I'm disconnected, and not whe...

How to detect if JavaScript file Is cached?

Background: I've been using LABjs to load JS files asynchronously and in parallel, and I want to build something that takes it a step further. Part of this will involve detecting when a JS file is loaded in cache or not. So my question is: How can I determine whether a JS file is in cache or not and in addition do so in a way that would...

XHR doesn't work because "Origin is not allowed by Access-Control-Allow-Origin".

I'm working on a API-Server with Rails 3 wich is pretty handy so far but I'm running across a error all the time and I'm not sure wether it is because of my Apache Setup or the Rails App. When I try to do a HTTP DELETE or PUT request on http://sample.domain/uri/id via XHR, curl or HTTP-Client.app Rails or Apache responds with 404 or 403...