xmlhttprequest

Making JavaScript call across domains

Here's the goal: Hand off a script tag that references a JavaScript file on a remote server. That JavaScript file should return HTML that will then be displayed on the calling HTML page. I've attempted to approach this in two ways: First, I attempted to use XMLHttpRequest in JavaScript to call this remote server. In IE, it would wor...

Passing Value Including Spaces on Ajax Call

Trying to pass spaces along with ajax call. 'word' is been passed the same as 'word ' i believe so. On the other hand two words need to be send completely with call. 'word second' but not the same as 'word second ' Should I trim before call or do this on server side script? How can I send spaces as well? ...

Problem in Loading xml from specified url using javascript in FF & Google Chrome

Hi, I need to load xml file from specified url using javascript. Here is what i am doing: function GetXMLDoc() { var url = 'http://www.warm.fm/exports/NowOnAir.xml'; var httpRequest = null; try { httpRequest = new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { try { httpRequest = new Acti...

XMLHttpRequest Basic Auth, second request

Hello, normally browser stores and adds authentication header automaticly after successfull authentication. I have a XMLHttpRequest and added the authentication header for basic auth. No problem at all. Then I try to send a second request to the same url that is basic http protected without adding manually the http request header t...

responseXML always null

Im using firefox 3.6.10, and firebug to debug So, here is my code: var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", url,false); xmlhttp.setRequestHeader('Content-Type', 'text/xml'); xmlhttp.send(null); alert(xmlhttp.responseXML); responseXML is always null, and i've tried it on several URLs from different domains. I have also...

XMLHttpRequest JS Image loading

Hi, I want to create a website which loads a image via XMLHttpRequest(). (XMLHttpRequest because I want to represent the user a % progressbar) My Code: var req = new XMLHttpRequest(); req.addEventListener("progress", onUpdateProgress, false); req.addEventListener("load", onTransferComplete, false); req.addEventListener("error"...

Detecting ajax request with PHP on Lighttpd a web server

Hi there, I'm having some trouble with detecting a jQuery ajax request with PHP on a Lighttpd web server. Here's the following code (works fine on MAMP and Apache): if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { // ajax (not recognized on lighttpd server) e...

How to view the last GET HTTP request in JavaScript

How can I view the last GET http request in JavaScript? Basically what I am after is what I can see my firebug console. When XMLHttpRequests are showing in console I see a line that looks something like: GET http://www.domain.com/php/file.php?q0&c=1 200 OK 163ms How do I view that URL in JavaScript? EDIT: Just to be clear...

using JavaScript how to capture all XMLHttpRequest onreadystatechange ?

Hi all, I am developing an extension from Chrome and I need to do some changes to the page code after it is loaded. but the problem is window.onload event isn't useful nowadays where almost any website is using AJAX. You can't assume that all content is already loaded because window.onload is fired before all AJAX request has done loadin...

Outgoing http data compression

Hello All, Is anybody know, is it possible to compress my outgoing http data in IE? I perform ajax requests to a server and want to reduce amount of traffic in order to speed up my app. Thanks, Egor ...

XMLHttpRequest read progressive data not working?

I'm having issues with XMLHttpRequest downloading progressive data. I get a state 2 and than state 3. After state 3 it never gets called again... What am I doing wrong? I read somewhere I need to flush the data but how do I do that? Here is my code: var xmlHttp = new XMLHttpRequest(); // try to connect to the server try...

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 (...

XMLHttpRequest different in IE8 vs. FireFox/Chrome

I'm having a problem similar to http://stackoverflow.com/questions/2721970/jquery-ajax-not-working-in-ie8-but-it-works-on-firefox-chrome, but with a different use case. I'm using the jQuery Form plug-in to handle a file upload to an ASP.NET MVC controller, which sends the file off for parsing and processing. If an Exception is thrown, ...

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...

Automatic web-page refresh memory leak using XMLHttpRequest

Greetings, I've been working on a web-interface for some hardware that uses an 8-bit microcontroller. The web page uses HTML, javascript, JSON and XHR (XMLHttpRequest) for its communications. What I'm trying to do is create a page that updates every 250mS with new values from the controller using setInterval so that the web page gets u...

When loading a page via javascript/XHR, hitting back causes unwanted scrolling

I am working on an existing website that we're adding some additional functionality to. A large number of users visit the site in the following manner: Page A -> Page B -> Page C -> back button to page B -> Page D -> back button to page B, scrolling -> Page C -> back button to page B, scrolling -> Page E, etc, etc. There is an alter...

Send XML file to Web Service using Java.

Hi, I want to send an XML file to a Web Service. The Web Service is a java application. I know the endpoint of the Web Service. Typically I know I have to create the request and send it as an http/https request. What I want to know is what would I have to make to send the request - as in what development tool could I use e.g. Visual We...

XmlHttpRequest.responseText while loading (readyState==3) in Chrome

Hi, I am trying to "streaming" (from server to client) in Javascript by ajax (by XmlHttpRequest (=xhr). I am using modified handleResponse function described in http://stackoverflow.com/questions/1112413/cross-browser-implementation-of-http-streaming-push-ajax-pattern function handleResponse() { if (http.readyState != 4 && http.readySta...

XMLHttpRequest returns status of 0 in Firefox 3.6.10 and up from cross origin requests.

Hi, I am developing an application that makes a cross origin AJAX request to an HTTP server written using Netty. An example of the type of Javascript code being executed is below. $.ajax({ type:"GET", url:"http://localhost:5000/someresource", data: { id1: "1", id2: "2" }, succes...

OpenLayers Format JSON is Returning Empty responseText String

Hello StackOverflow, After a week of posting at the OpenLayers forum and not receiving responses to my questions, I have decided to look here. I have Googled and Googled and Googled and even found a wonderful tutorial concerning this topic, in Spanish, but so well written that Google translate was able to translate it perfectly. gis...