xmlhttprequest

Load XML formatted files with different extension than .xml using XMLHttpRequest object

I have this code that loads an xml file using javascript: function getXmlDocument(sFile) { var xmlHttp, oXML; // try to use the native XML parser try { xmlHttp = new XMLHttpRequest(); xmlHttp.open("GET", sFile, false); // Use syncronous communication xmlHttp.send(null); oXML = xmlHttp.responseXML; } catch (e) { // c...

Using XHR to send large amounts of data via POST.

Hello, I have an XHR that uploads large amounts of data to the server. This XHR dies intermittently and seemingly without pattern. Currently my code looks like this: function makeFormData(data) { var formdata = ""; for (var key in data) { formdata = formdata + "&" + key + "=" + encodeURIComponent(data[key]); } re...

Windows C++ Should I use WinHttp library or XmlHttp from MSXML?

A rather simple question. Should I use the WinHttp library to make a web service request in my C++ programs or should I use the IXmlHttpRequest interface in the msxml library to send web service requests? Obviously the WinHttp library provides a lot more fine control compared to the IXmlHttpRequest library. But the XmlHttpRequest object ...

Which Http Status code to return when user provided data fails validation in Web Service?

When the user enters data and submits that data, we pass it to the server using and XMLHttpRequest. But, if that data fails validation, we have to return a 400 level status code. I thought the appropriate code would be 403. However, my colleague doesn't agree but doesn't know which to use. Which one would you use? Thanks! ...

Fetching xml with GM_xmlhttpRequest

I'm trying to retrieve a page with greasemonkey and then extract a link from it, inserting the link into the current page. I'm having some trouble with: GM_xmlhttpRequest({ method: "GET", url: "http://www.test.net/search.php?file=test", onload: function(data) { if (!data.responseXML) { data.responseXML = new DOMParser...

Ajax only return readyState == 4 value

Ok I've looked everywhere for this. I'm cutting out a couple of the variable declarations, as I can ensure that my XMLHttpRequest is working. function submit_edit_form() { // id and title are already declared var x = ajax_edit_form_save(id, 'title', title); alert(x); } function ajax_edit_form_save(id, property, new_value) { ...

Accessing XHR (XMLHTTPRequest) content when using WebKit in Objective C.

I've been trying for hours with all the different delegate methods to access the content of an XHR request that is automatically requested when a page is loaded. I have used the following which has shown that WebKit is seeing the request in the first place (as the URL that's displayed is the correct one). - (void)webView:(WebView *)sen...

Present XMLHTTPRequest Response to the Client?

I am using an XMLHTTPRequest to fake a RESTful interface. After the response object returns data from the request, how can i present that to the user? For example, in a PUT request, the server actually responds with a full HTML page of data (in most cases), and i want to display this whole page to the client. Any idea how? I'm sure there...

XMLHttpRequest responseText & javascript

So I have two pages: index.php and contents.php. Index.php is doing an XMLHttpRequest to grab a table from contents.php... But when Index.php displays the response.Text, it doesn't run the Javascript originally on contents.php (because it's just displaying the contents, not running the script). Trying to solve this problem, I simply pu...

Using xmlhttprequest in IE only includes the contents of the body tag

When I try to get the contents of a htm file into a div using a xmlhttprequest object in Firefox it includes everything, but in IE it only includes the contents of the body tag. In other words it ignores all the styling (in the head tag) of the page, rendering it ugly. Is it possible to get the full page when using xmlhttprequest in in...

loop through some urls using XMLHttpRequest's open() function

i am making a XMLHttpRequest open() call from a for loop.the loop iterates through set of links.I want to wait till the readyState becomes 4(the response comes) before going in to the next iteration.How can i do this?please help ...

How does Omegle direct connect with HTTP Protocol?

Every ajax chat tutorial ends the same. You run a getChatMsg.php or some script every X milliseconds to check for new messages. But not omegle.com they only send you a packet when you really need it not every X milliseconds. For example I run every ajax chat tutorial i setup and sniff the packets I get a flow of getChatMsg or similar ...

problem using HTML5 for Cross-origin resource sharing

Hi, I am new to this site and had been successfully using the "HTML5" Cross-origin resource sharing (CORS) to POST data to my server. I just recently tried to include GETs in that as we are trying to have all of our communications be non-reliant on a JavaScript library. In doing so I have run into an odd issue that seems somewhat fixable...

JavaScript error when trying to fire simple XMLHttpRequest (GET)

Bit of a JavaScript newbie here - I am firing this basic bit of JavaScript code from my website as a test: var req = new XMLHttpRequest(); req.open('GET', 'http://www.google.co.uk/', false); req.send(); if (req.status == 200) { alert(req.responseText); } and I keep getting the following error: [Exception... "Component return...

File content in Javascript in a Browser

The only way I know to take the contents of a local file and push those bytes to a server is to set up a form post with an <input> of appropriate type to prompt the user to select a file. I would like to do the same thing only pushing the data through XMLHttpRequest (no cross-scripting tricks). Currently, we do this with an iframe to g...

how to compare xmlhttp.responsetext?

my code- document.getElementById("lblmsg").innerHTML=xmlhttp.responseText; if(xmlhttp.responseText == 'Available') { document.getElementById("newid").value = ""; } although response text is Available but still it is not going inside if condition??...

Help reading JSON from HttpContext.InputStream

I have created a HttpModule to capture requests for auditing purposes. For Ajax requests to a web method I would like to also log the JSON data associated with the request. E.g Request POST /MyPage.aspx/AddRecord HTTP/1.1 x-requested-with: XMLHttpRequest Accept-Language: en-gb Referer: http://fiddlerlocal:5000/AddRecord.aspx ...

JAVASCRIPT / AJAX : Why I'm NOT getting xmlhttp.readyState 1 and 4 ?

My Problem xmlhttp.readyState is always 2 then 3 in firefox and other browsers in Internet Explorer the opposite, and 1 and 4 is missing. My Code function like(id,type){ if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 ...

AdBlock is killing my XMLHttpRequests ... work-around?

A quick Google search shows that this is a common problem: AdBlock Plus for Firefox kills XMLHttpRequests. Throws an exception: "Component returned failure code: 0x805e000a." However, the only prescription I could find is to send random parameters in my ajax call but that didn't work. I've renamed file extensions, tried just about ...

Getting Data Out of a XMLHttpRequest

Hello, This has been bothering me for ages and I tried everything and I cannot get it to work. Here is my function currently function example1() { var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", url,true); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { data=(xmlhttp.responseText); ...