xmlhttprequest

Problem in getting Http Response in chrome

Am trying to get http response from php web service in javascript, but getting null in firefox and chrome. plz tell me where am doing mistake here is my code, function fetch_details() { if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest() alert("first"); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP") alert("sec"); ...

How do I receive and respond to Ajax requests in Perl?

I have a client-side appliction which submits some data via AJAX POST request (request.open("POST", url, flag)) to my Perl CGI script. How do I retrieve this data with Perl and return some other data (AJAX response)? ...

Can you detect a 301 redirect with Microsoft.XMLHTTP object?

I'm using VBScript and the Microsoft.XMLHTTP object to scrape some web data. I have a list of URLs to check, but unfortunately some of them 301 redirect to others on the list, so I wind up with redundant data. Is it at all possible to make the XMLHTTP object fail on 301 redirect? Or at least cache the original response header? Or oth...

[JS] XMLHttpRequest problem

I am trying to do "POST" with XMLHttpRequest in a firefox extension, and after that I try to get the "Location" header and open it in a new tab. For some reason, the XMLHttpRequest doesn't contain a location header. My code function web(url,request) { var http = new XMLHttpRequest(); http.open('POST',url,true); http.setReq...

HEAD XMLHttpRequest on Chromium

I'm trying to get the HEAD response with an XMLHttpRequest in Chromium to retrive the location URL of a compressed url, but it fails: var ajax = new XMLHttpRequest(); ajax.onreadystatechange = function() { if (ajax.readyState == 4) alert(ajax.getResponseHeader("Location")) }; ajax.open('HEAD', "http://bit.ly/4Agih5", false); ajax.send()...

Ajax back forward problem

i use Ajax in my page, and dynamicaly load content, but in this case my back/forward does't work. could you tell me how can i solve this problem? thanks ...

javascript conflict on accesing DOM

i read this statement from a book i read The Document Object Model or DOM is really not a part of JavaScript but a separate entity existing outside it. Although you can use JavaScript to manipulate DOM objects, other scripting languages may equally well access them too. what is the best way to avoid conflict between javascript and o...

Find the xmlHttpRequest resource in aspx page

I'm trying to find an xmlHttpRequest or similar resource that I can query directly to obtain an xml file for my own purposes. At this site it is possible to browse a Google Map mashup with markers. Unfortunately it is only possible to view all markers at a small view range, whereas I simply want to obtain all the information at once fo...

XMLHttpRequst return null on Chrome

I have the following code that works fine in IE: <HTML> <BODY> <script language="JavaScript"> text=""; req = new XMLHttpRequest(); if (req) { req.onreadystatechange = processStateChange; req.open("GET", "http://www.boltbait.com", true); req.send(); } function processStateChange() { // is the data ready for use? if ...

Is there a better way to serially submit multiple AJAX requests?

I have a page with multiple forms that I submit via Ajax POSTs serially. At first, I tried using synchronous XHR requests, but this causes the browser to lock up for the duration of the request, and breaks my DOM-manipulation effects, which is unacceptable. So the pattern I ended up using is basically this: var fcount = 0; // increme...

Can a script called by XHR reference $_COOKIE?

Quick yes/no - I'm building an AJAX application and some scripts require authentication. Can I read $_COOKIE['username'] and $_COOKIE['password'] on the server if the PHP script was called via XHR, whether that be $.get() or $.post()? Side question: Can it also set cookies? Is that considered "good practice"? ...

Comet (long polling) and XmlHttpRequest status

I'm playing around a little bit with raw XmlHttpRequestObjects + Comet Long Polling. (Usually, I'd let GWT or another framework handle of this for me, but I want to learn more about it.) I wrote the following code: function longPoll() { var xhr = createXHR(); // Creates an XmlHttpRequestObject xhr.open('GET', 'LongPollServlet', tru...

Retreiving data from MySQL with html/javaScript on one domain and the PHP file on the other

I need to retrieve data from a MySQL database, and have it work one way for all types of servers. For example it should work on a server that runs no server side language, it should also work on LAMP, and IIS. I was thinking about using ajax and xmlhttprequest, but learned of the cross domain limitation. I also tried to just include the...

Do I need jsonp?

Since firefox 3, cross domain XmlHttpRequest is available. As my understand, jsonp is also doing something about cross domain. If I only need to deal with firefox 3, do I still need to use jsonp? ...

xmlhttprequest always return with status code 0 for firefox

hi, I am trying to make asynchronous calls using xmlhttprequest object so it completely works fine in internet explorer but for firefox it wont work a small code snippet of problem if (req.readyState == 4) { if (req.status == 200) //here firefox gives status code always 0 and for IE works fine { //read response ...

HTTP Request Error in Flex

Hi, I am getting a HTTP request error in Flex. Not always but sometimes. However I do see that the HTTP request was successfully sent to the backend. I am printing the "HttpService.lastResult.Error" which has this String. How can I get the root cause of this problem ? Apart from "HttpService.lastResult.Error" are there any other Flex ...

XMLHttpRequest - JSON - .NET

I am trying to send JSON from my mozilla addon to my asp.net page. var myJSONObject = {"userName": una,"password": pass}; request = new XMLHttpRequest(); request.open("GET","http://www.google.com?jo=" + myJSONObject,true, null, null); on my .net page I have tried several ways of doing it but not able to find the best way...

Navigate with location.href during XMLHttpRequest asynchronous call

I have a web page containing something like this: <div onclick="location.href = 'AnotherPage';"> This page also uses asynchronous XMLHttpRequests for some ajax updating. I have found that while an asynchronous XMLHttpRequest is in progress, clicking on this div does not load the new page. If I cancel my request first then it works fi...

Google Web Toolkit Deferred Binding Issue

I developed a web app using GWT about 2 years ago, since then the application has evolved. In its current state it relies on fetching a single XML file and parsing the information from it. Overall this works great. A requirement of this app is that it needs to be able to be ran from the filesystem (file:///..) as well as the tradition...

Setting headers in XDomainRequest or ActiveXObject('Microsoft.XMLHTTP')

I'm trying to do something like this (W3 compliant, DOM): xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest' ); For ActiveXObject('Microsoft.XMLHTTP') and XDomainRequest (IE8). I'm having no such luck finding it anywhere in microsoft documentation or even google. Any idea how I can achieve this? ...