xmlhttprequest

Problem: XMLHttpRequest - handle server connection lost

Hi All, How do I handle the scenario where I making a synchronous request to the server using XMLHttpRequest and the server is not available? xmlhttp.open("POST","Page.aspx",false); xmlhttp.send(null); Right now this scenario results into a JavaScript error: "The system cannot locate the resource specified" ...

Ajax Asynchronous in IE - Error "The Data Necessary to Complete This Operation is Not Yet Available"

Hey there. I have a 100% valid Ajax model written in Javascript with a few inputs I use being, Get or Post method, What page to communicate with, What String to send to that page and What element on my own page I might be fiddling with when I receive my response. The problem is that, should I set the request to Asynchronous (Hence Ajax),...

Is there anyway to change the content type of an XML document, in the XML document?

Is there anyway to change the content-type of an XML document, in the XML document? I'm working with a really old system that passes back HTML (and we are trying to make it return XML). I'm retrieving it from XMLHttpRequest, and I noticed using netcat that it isn't passing back any content-type headers. When I receive the XMLHttpRe...

cross-site XmlHttpRequest in Firefox?

I understand (I think) that XmlHttpRequest objects adhere to the "same-domain" policy. However, I want to create a simple (POC) local html file that downloads XML from a web server and does something with it (let's start with a simple "alert()"). Is it possible at all? Do I need a special Firefox config option? The server from which I'...

Mootools request - cannot make the examples work

I've downloaded the examples for both the Request and Request.HTML and cannot make either work. I unzipped them to a folder and browsed to their index.html to execute them as is, but the response is always "The request failed." with no clues as to why. I've played around with them with different permutations and can get the request to c...

Cross-site XMLHttpRequest

I want to provide a piece of Javascript code that will work on any website where it is included, but it always needs to get more data (or even modify data) on the server where the Javascript is hosted. I know that there are security restrictions in place for obvious reasons. Consider index.html hosted on xyz.com containing the following...

Implementing a self resetting XMLHttpRequest object

I'm trying to implement a comet style, long polling connection using an XMLHttpResponse object. The idea is to maintain an open connection to a server which sends data when it is available (faking push). As soon as the XHR object completes, I need to spawn a new one to wait for any fresh data. Below is a snippet of code which outlines a...

AJAX - Reload a part of a webpage without the use of a separate file to load

Title might be a bit confusing, so let me explain. I have a website that has a side-panel, which contains information about the user, things the user can do, etc. When the user is not logged in, this side-panel becomes the area for logging in or registration. The code for this is: <?php if($user->loggedIn) { ?> <!-- side-panel for log...

Best method of Instantiating an XMLHttpRequest object

What is the best method for creating an XMLHttpRequest object? It should work in all capable browsers. ...

Kill ajax requests using javascript using jquery.

How do I cancel an ajax request that I have not yet received the response from using jquery? ...

Passing arguments to anonymous javascript functions

Consider the code below: this.usedIds = 0; this.SendData = function(data) { var id = this.usedIds; this.usedIds++; this.xmlHttpThing.open("POST", "/Upload.aspx", true); this.xmlHttpThing.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); var currentObject = this; this.xmlHttpThing.onreadyst...

AJAX browser-dependent limit on length of data sent? (SAJAX)

EDIT: now the question becomes, how do I tell Sajax to use POST instead of GET? I've tried some examples from google but they are sketchy, and as I said, they didn't work. I know, we're all jQuery nuts around here. I've used the following code to try and find a limit to the amount of data that can be sent to the server via an ajax cal...

Best way to store data for Greasemonkey based crawler?

I want to crawl a site with Greasemonkey and wonder if there is a better way to temporarily store values than with GM_setValue. What I want to do is crawl my contacts in a social network and extract the Twitter URLs from their profile pages. My current plan is to open each profile in it's own tab, so that it looks more like a normal br...

auto-refreshing div with jquery

When trying to use the code presented here link text I ran into some problems, which was suggested to open up a new question for this problem. Im an using that code here link text trying to create a backchannel for a meeting (it uses the twitter search api to display data, so try please try it with some hashkey to get data in). The probl...

Using XMLHttpRequest to display a popup

I am writing an ASP.NET 3.5 web app that displays a list of items. I want to be able to display a non-modal popup with details when the user selects an item. I want to be able to display several detail popups simultaneously. (i.e., the user can click an item to see its details, then click another item to get another popup.) Currently I c...

How many concurrent AJAX (XmlHttpRequest) requests are allowed in popular browsers?

In Firefox 3, the answer is 6 per domain: as soon as a 7th XmlHttpRequest (on any tab) to the same domain is fired, it is queued until one of the other 6 finish. What are the numbers for the other major browsers? ==== Update: ==== Here's the list so far -- please help complete it! Number of concurrent requests of any type (including...

ready-to-use xmlRequest snippet returns status code 0 on a call

I'm creating a very basic dashcode widget. I'm using customized snippets from Apple: xmlRequest setup and xmlLoaded. Below is my code function sendURL(){ // Values you provide var textField = document.getElementById("searchqeue"); // replace with ID of text field var textFieldValue = textField.value; var feedURL = "feed...

What are the advantages and disadvantages of json vs xml for ajax requests?

What are the advantages and disadvantages of json vs xml for ajax requests? Is there a difference in performance? i.e. are browsers able to process one format faster than the other? ...

At which point in the life of an xmlHttpRequest object is serialised XML parsed into a DOM?

In JavaScript, xmlHttpRequest.responseXML() returns a DOM Document object. The DOM Document object is created from an XML-structured HTTP response body. At what point during the life of an xmlHttpRequest object is the XML string parsed into the DOM Document? I can imagine it may occur in one of two places. When responseXML() is calle...

How can I clear HTTP headers for AJAX GET calls?

I have developed a solution that relies on an AJAX call to retrieve information and update the client page every 10 seconds. This is working fine, but I am concerned at the scalability of the code, given the number and length of headers being passed from client to server and back again. I have removed a number of redundant headers on the...