xmlhttprequest

Handle JSON Object in XMLHttp response in Excel VBA Code

巧了我就是萌 提交于 2019-12-17 15:46:15
问题 I need to handle a JSON Object which is the response of XMLHTTPRequest in Excel VBA. I wrote the code below, but it doesn't work: Dim sc As Object Set sc = CreateObject("ScriptControl") sc.Language = "JScript" Dim strURL As String: strURL = "blah blah" Dim strRequest Dim XMLhttp: Set XMLhttp = CreateObject("msxml2.xmlhttp") Dim response As String XMLhttp.Open "POST", strURL, False XMLhttp.setrequestheader "Content-Type", "application/x-www-form-urlencoded" XMLhttp.send strRequest response =

Downloading an image using XMLHttpRequest in a userscript

邮差的信 提交于 2019-12-17 15:44:39
问题 First of all there is a question with the same title here on SO but its not what I'm looking for and it doesn't have a complete answer either. So here's my question. Say I have this URL which directs to an image. https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/299595_10150290138650735_543370734_8021370_355110168_n.jpg Once I put this parameter ?dl=1 to the end of the URL, it becomes downloadable. https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/299595_10150290138650735_543370734

Capture redirect location of javascript XMLHttpRequest

匆匆过客 提交于 2019-12-17 15:44:36
问题 I know that you can't, when using an XMLHttpRequest, intercept a redirect or prevent it, as the browser will transparently follow it, but is it possible to either A. Determine whether a request redirected, or B. Determine where it redirected to? (assuming that the response gives no hints) Example code: $.post("/my-url-that-redirects/", {}, function(response, statusCode, xmlHttpRequest){ //Somehow grab the location it redirected to } ); In my case, firebug will first show a POST to the url,

Cross-browser implementation of “HTTP Streaming” (push) AJAX pattern

巧了我就是萌 提交于 2019-12-17 15:31:35
问题 Client request web page from server. Clent then requests for extra calculations to be done; server performs series of calculations and sends partial results as soon as they are available (text format, each line contains separate full item). Client updates web page (with JavaScript and DOM) using information provided by server. This seems to fit HTTP Streaming (current version) pattern from Ajaxpatterns site. The question is how to do it in cross-browser (browser agnostic) way, preferably

Why do browser APIs restrict cross-domain requests?

邮差的信 提交于 2019-12-17 15:23:14
问题 XMLHttpRequest s require CORS to work cross-domain. Similarly for web fonts, WebGL textures, and a few other things. In general all new APIs seem to have this restriction. Why? It's so easy to circumvent: all it takes is a simple server-side proxy. In other words, server-side code isn't prohibited from doing cross-domain requests; why is client-side code? How does this give any security, to anyone? And it's so inconsistent: I can't XMLHttpRequest , but I can <script src> or <link rel> or <img

Phantom JS synchronous AJAX request : NETWORK_ERR: XMLHttpRequest Exception 101

为君一笑 提交于 2019-12-17 12:14:08
问题 I am making a synchronous ajax call ( ajax settings async: false ). This works well. Now I'm trying to write an automated test for this in phantomJS and I'm getting this error NETWORK_ERR: XMLHttpRequest Exception 101 I checked my service logs and it seems like service is not getting any request. 回答1: Try disabling the web security by using the command-line option --web-security=no when running your script. ( phantomjs --web-security=no yourscript.js ) From the PhantomJS reference (http:/

How to make XMLHttpRequest cross-domain withCredentials, HTTP Authorization (CORS)?

拟墨画扇 提交于 2019-12-17 10:45:22
问题 I'm unable to make a cross-domain request with an Authorization header (testing with Firefox). I have requests working without authentication, but once I set withCredentials to true I am no longer able to read the response from the server. On the server I send back these headers (using an after_request method in Flask): resp.headers['Access-Control-Allow-Origin'] = '*' resp.headers['Access-Control-Allow-Credentials'] = 'true' resp.headers['Access-Control-Allow-Methods'] = 'POST, OPTIONS' resp

XMLHttpRequest: Multipart/Related POST with XML and image as payload

…衆ロ難τιáo~ 提交于 2019-12-17 10:42:21
问题 I'm trying to POST an image (with Metadata) to Picasa Webalbums from within a Chrome-Extension. Note that a regular post with Content-Type image/xyz works, as I described here. However, I wish to include a description/keywords and the protocol specification describes a multipart/related format with a XML and data part. I'm getting the Data through HTML5 FileReader and user file input. I retrieve a binary String using FileReader.readAsBinaryString(file); Assume this is my callback code once

Internet Explorer 11 does not add the Origin header on a CORS request?

旧时模样 提交于 2019-12-17 09:46:23
问题 My issue depends on a couple of assumptions I hold true. Assumption nr 1: The Origin Header The Origin header is required by the browser to be put on a CORS (Cross Origin Resource Sharing) request. Wikipedia: To initiate a cross-origin request, a browser sends the request with an Origin HTTP header. HTML5 Rocks: The first thing to note is that a valid CORS request always contains an Origin header. This Origin header is added by the browser, and can not be controlled by the user. W3: If the

What is the difference between XMLHttpRequest, jQuery.ajax, jQuery.post, jQuery.get

对着背影说爱祢 提交于 2019-12-17 08:04:21
问题 How can I find out which method is best for a situation? Can anybody provide some examples to know the difference in terms of functionality and performance? 回答1: XMLHttpRequest is the raw browser object that jQuery wraps into a more usable and simplified form and cross browser consistent functionality. jQuery.ajax is a general Ajax requester in jQuery that can do any type and content requests. jQuery.get and jQuery.post on the other hand can only issue GET and POST requests. If you don't know