xmlhttprequest

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

纵然是瞬间 提交于 2019-12-18 05:35:09
问题 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? 回答1: Referring to this post http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx See the point three 3. No custom headers may be

How to VBA sends an Async XMLHTTP request?

删除回忆录丶 提交于 2019-12-18 05:17:14
问题 To get data from a webservice in Excel, I have created an excel addin provide function to get it; user just need type in cell: =sendRequest("http://webservice.com") I have 2 excel files to demostrate the sending request in two methods: 1.synchronous and 2.asynchronous In sync method, the function can send request and get data normaly. But, if we have 100, 200 cells that call it, it will take Excel a huge amount of time waiting; which also makes Exel to be not respoding . My current solution

Uploading a file with XMLHttprequest - Missing boundary in multipart/form-data

假装没事ソ 提交于 2019-12-18 04:49:09
问题 I'm uploading a file with XMLHttprequest. Here is the JS function, that uploads a file: var upload = function(file) { // Create form data var formData = new FormData(); formData.append('file', file); var xhr = new XMLHttpRequest(); // Open xhr.open('POST', this.options.action); // Set headers xhr.setRequestHeader("Cache-Control", "no-cache"); xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); xhr.setRequestHeader("Content-Type", "multipart/form-data"); xhr.setRequestHeader("X-File

What do browsers want for the Content-Type header on json ajax responses?

若如初见. 提交于 2019-12-18 04:14:56
问题 I am returning some json which needs to be handled by javascript as the response to an XMLHTTPRequest. If I set the response's content type to "text/plain", all browsers but Chrome will accept it and pass it to my JS with no problem. However, Chrome will wrap the response in <pre style="word-wrap: break-word; white-space: pre-wrap;"> before passing it to my javascript. If I set the response's content type to the "proper" "application/json" all browsers but Firefox will accept it and pass it

XHR request URL says does not exist when attempting to parse it's content

混江龙づ霸主 提交于 2019-12-18 03:44:13
问题 Before I build a full solution to my problem using Scrapy I am posting a simplistic version of what I want to do: import requests url = 'http://www.whoscored.com/stageplayerstatfeed/?field=1&isAscending=false&orderBy=Rating&playerId=-1&stageId=9155&teamId=32"' params = {'d': date.strftime('%Y%m'), 'isAggregate': 'false'} headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36'} response = requests.get

XHR request URL says does not exist when attempting to parse it's content

吃可爱长大的小学妹 提交于 2019-12-18 03:44:11
问题 Before I build a full solution to my problem using Scrapy I am posting a simplistic version of what I want to do: import requests url = 'http://www.whoscored.com/stageplayerstatfeed/?field=1&isAscending=false&orderBy=Rating&playerId=-1&stageId=9155&teamId=32"' params = {'d': date.strftime('%Y%m'), 'isAggregate': 'false'} headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36'} response = requests.get

MSXML2.XMLHTTP send method works with early binding, fails with late binding

别来无恙 提交于 2019-12-18 03:37:20
问题 The code below works. But if I comment out the line Dim objRequest As MSXML2.XMLHTTP and uncomment the line Dim objRequest As Object it fails with the error message : The parameter is incorrect Why, and what (if anything) can I do about it? Public Function GetSessionId(strApiId, strUserName, strPassword) As String Dim strPostData As String Dim objRequest As MSXML2.XMLHTTP 'Dim objRequest As Object ' strPostData = "api_id=" & strApiId & "&user=" & strUserName & "&password=" & strPassword Set

How to retrieve XHR response code (+timestamp) of AMD'ized Dojo?

ε祈祈猫儿з 提交于 2019-12-18 03:37:06
问题 With the "old" Dojo one could pass a second argument ioargs to the load function of a Xhr request (see Example 6 here). This ioargs provided (among other things) the timestamp and status code of the request. But how can I achieve this with the new and "cleaner" (and forward compatible) Dojo? Unfortunately, I could not find any hints in the current documentation. The following should be a port of above referenced example to the "new" Dojo. But, ioargs will be undefined: require( "dojo/request

Why is it called XMLHttpRequest?

半城伤御伤魂 提交于 2019-12-18 03:01:00
问题 I always wonder why this object is called like that? The body of your request does not need to be in XML format. Also, data received from server can be fetched as JSON, XML, HTML, or plain text. XML does not play an essential part in this object. Is this some kind of a cliché? What is this object used to be when it was first created? 回答1: XMLHttpRequest was invented by Microsoft's Outlook Web Access team. This highly innovative team previously gave us remote scripting, which was the the

XMLHttpRequest in for loop

时间秒杀一切 提交于 2019-12-18 02:48:18
问题 I am trying to make several server requests inside a for loop. I found this question and implemented the suggested solution. However it doesn't seem to work. for (var i = 1; i <= 10; i++) { (function(i) { if(<some conditions>) { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp[i]=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp[i]=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp[i].onreadystatechange=function() { if (xmlhttp[i].readyState==4 &&