xmlhttprequest

How can get a list of the functions in a javascript file?

I'm trying to cobble together a php style include function for javascript. The route I'm taking is through a XMLHttpRequest. The included file will load, but the functions in that file aren't available as their scope is limited to the function that is calling them. I came across this article which achieves a similar goal, but requires ...

Malformed HTTP requests on rails?

Hi all, I'm getting this occacional error from my rails app: ActionController::MethodNotAllowed: Only get, put, and delete requests are allowed. I think it's caused by a malformed HTTP request (in this case a DELETE request) caused by the client browser... Maybe? The URL that triggers this action it's like: https://domain.com/resour...

Disable the Same Origin Policy / making cross domain XMLHttpRequests in WebKit WebViews?

I would like to disable the same origin policy on XMLHttpRequests in my own embedded WebViews. I have control over the pages loaded / code being executed in the WebView, so I do not care about enforcing the same origin policy. I would like to make cross-domain requests. I've tried implementing the WebPolicyDelegate and WebResourceLoadDe...

Headers to set for AJAX calls in a custom webserver

I'm writing a custom web server. When I enter the URL of my server in the browser, I get the sample text I write out to the socket in my browser correctly. This is the HTTP response that I write: HTTP/1.1 200 OK\r\n Server: My Server\r\n Date: Blah\r\n Content-Type: text/plain\r\n \r\n This is some sample text. This appears in my browse...

response from server

When I create request to the server: <script language="javascript" type="text/javascript"> function ajaxFunction() var ajaxRequest; try{ ajaxRequest = new XMLHttpRequest(); } catch (e){ try{ } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser broke!"); return false; } } } ajaxReque...

msxml XMLHTTPRequest and timeout

Hi, what determins the timeout value for XMLHTTPRequest (msxml version) send method? I'm calling it from MS Sql server and the server profiler shows me 'completed' after 30 seconds, the same happens when calling it through client programm calling stored proc. I set the client connection timeout to 120 sec. So im thinking it must be msxm...

How to check if XMLHttpRequest's send() supports File

Safari's XMLHttpRequest's send() method supports a File argument. Firefox does not (yet). How can I check if this is supported? In Firefox, it will just behave as if an empty string was passed. I'm trying to avoid doing browser version detection. Edit: FF 3.6 does seem to support it, but the question is still relevant for older versio...

Elegant way to import XHTML nodes from xhr.responseXML into HTML document in IE?

While navigating through a site, I'm dynamically loading pages via Ajax and then only updating the elements of the page that are changed, such as the navigation state and main content area. This is similar to Lala. I am serving the site as XHTML in order to be able to have access to xhr.responseXML which I then traverse in parallel with ...

Problem with Twitter basic authentication using AJAX

EDIT: This question is now redundant since Twitter no longer supports basic auth. I've left it up since it's relevant to anyone doing basic auth via AJAX on other services. I'm developing a javascript App that needs, as part of its functionality, for users to be able to update their Twitter status. The App is designed to work on mobil...

Insert record in SQL Server from xmlhttp request object

Can anyone tell me, How to insert one record in SQL Server by using the xmlhttp object and Asp.net ...

Cookies not present after using XMLHttpRequest

Update: It looks like after receiving a 403 response, the xmlhttprequest just hangs there, and so the document.location code is never executed, any ideas on how to get around this? I'm trying to make a bookmarklet to download videos off of YouTube, but I've come across a little problem. To detect the highest quality video available, I ...

Why isn't IE displaying this alert()?

I have the following piece of code: // setup the AJAX request var pageRequest = false; if(window.XMLHttpRequest) pageRequest = new XMLHttpRequest(); else if(window.ActiveXObject) pageRequest = new ActiveXObject("Microsoft.XMLHTTP"); // callback pageRequest.onreadystatechange = function() { alert('pageRequest.readyState: ' + pa...

How to remove HTTP specific headers in Javascript

Is it possible to, before sending a http message, remove some specific http headers using javascript / XmlHttpRequest ? I'm using a proprietary browser, so there's no way to do it using browser specific solution. For example, I want to remove the header 'Authorization' before send the message POST /social/rpc?oauth_version=1.0& ... HT...

why multipart/x-mixed-replace is needed for Comet?

I'm reading this article about Comet http://en.wikipedia.org/wiki/Comet_(programming). It mentions that browser should support multipart/x-mixed-replace to make XmlHttpRequest Streaming possible. Why this multipart/x-mixed-replace is necessary? Without this header, HTTP response can still be chunked and sent piece by piece to browser, ...

GET and XMLHttpRequest

i have an XMLHttpRequest.The request passes a parameter to my php server code in /var/www. But i cannot seem to be able to extract the parameter back at the server side. below i have pasted both the codes: javascript: function getUsers(u) { alert(u);//here u is 'http://start.ubuntu.com/9.10' xmlhttp=new XMLHttpRequest(); var url="h...

What am I missing in the XMLHttpRequest?

Hi guys, I'm completely new to the javascript and ajax world but trying to learn. Right now I'm testing the XMLHttpRequest and I can't make work even the simplest example. This is the code I'm trying to run <script type="text/javascript"> function test() { xhr = new XMLHttpRequest(); xhr.onreadystat...

In XMLHttpRequest, where is error flag variable?

In the XMLHttpRequest Spec it says that: The DONE state has an associated error flag that indicates some type of network error or abortion. It can be either true or false and has an initial value of false. Also says something similar about a "send() flag" in an "OPENED" state. It's said in the specification but not in the ...

XmlHttpRequest with If-Modified since, webserver returns "400 Bad Request"

LS, Whenever I use the following code, the webserver (running IIS 7) refuses to send me content, but sends a "400 Bad Request" instead. request.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); Kind regards, Matthias Vance ...

How to set access-control-allow-origin in webrick under rails?

I have written a small rails app to serve up content to another site via xmlhttprequests that will be operating from another domain (it will not be possible to get them running on the same server). I understand I will need to set access-control-allow-origin on my rails server to allow the requesting web page to access this material. It ...

Why does CORS not seem to work with POST?

Mozilla's own specification says simple GET or POST should be natively CORS's without preflighting but so far every POST attempt I've made has resulted in an OPTIONS header going out. When I change it from POST to get the code immediately sends a proper GET request so the cross site part is working fine. Here's a slimmed down sample of...