xmlhttprequest

How do I return the response from an asynchronous call?

做~自己de王妃 提交于 2019-12-13 04:05:12
问题 I have a function foo which makes an Ajax request. How can I return the response from foo ? I tried returning the value from the success callback as well as assigning the response to a local variable inside the function and returning that one, but none of those ways actually return the response. function foo() { var result; $.ajax({ url: '...', success: function(response) { result = response; // return response; // <- I tried that one as well } }); return result; } var result = foo(); // It

Add header Access-Control-Allow-Origin to XMLHttpResponse in php

*爱你&永不变心* 提交于 2019-12-13 03:59:42
问题 I am sending XHR request to server written in php which is working fine. but at some cross domain origin are not allowing loading and processing the response from server. it is throwing error XMLHttpRequest cannot load http://mydomain/getInfo?blabla. Origin http://www.somedomain.com is not allowed by Access-Control-Allow-Origin. so how can I set Access-Control-Allow-Origin in the response headers in php? 回答1: If your JavaScript runs on example.com and the server you are requesting to is in

HTTP synchronous request stops my GIF moving in Chrome and IE?

喜你入骨 提交于 2019-12-13 03:54:46
问题 In Firefox, I have a synchronous request that happens (it must be sync or the later JS will not run correctly) now in the XMLHttpReq function it basically changes one of the DIV's contents to a tiny loading logo (turning cog) so you can see progress... In FF this works 100% async or sync... Chrome and IE no such luck..? Can anyone help me or explain why please? Im guessing it something to do with them disabling ALL other processes but if this is so how can i get this to work OR evaluate and

xmlHttpRequest displays eurosign as questionmark

老子叫甜甜 提交于 2019-12-13 03:35:01
问题 I use this script (from dynamicdrive) to dynamically fill div with id: var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no) var loadedobjects="" var rootdomain="http://"+window.location.hostname var bustcacheparameter="" function ajaxpage(url, containerid){ var page_request = false if (window.XMLHttpRequest) // if Mozilla, Safari etc page_request = new XMLHttpRequest(); else if (window.ActiveXObject){ // if IE try { page_request = new

How do I return the response from an asynchronous call?

余生长醉 提交于 2019-12-13 03:25:20
问题 I have a function foo which makes an Ajax request. How can I return the response from foo ? I tried returning the value from the success callback as well as assigning the response to a local variable inside the function and returning that one, but none of those ways actually return the response. function foo() { var result; $.ajax({ url: '...', success: function(response) { result = response; // return response; // <- I tried that one as well } }); return result; } var result = foo(); // It

Loading indicator with dojo XHR requests

风格不统一 提交于 2019-12-13 03:19:00
问题 I only recently started using dojo and I am doing numerous ajax calls using dojo xhrGet, xhrPost,..etc. Now I have an animated gif image which i want to use to indicate "loading" to the user. I am not too sure how this can be done. Can someone please advise me on this? here is my code, dojo.xhrGet({ url: registcarturl, handleAs: "json", preventCache: true, load: function(data, ioArgs) { //DO STUFF WITH data HERE }, error: function(error) { alert("sorry ! an error occurred while adding to the

vba how to read and store LTPA?

点点圈 提交于 2019-12-13 03:14:12
问题 I'm trying to establish a "silent" connection using WinHTTP or xmlHTTP starting from an Excel form to our intranet. I've just written code that opens IE, does login, passes data, compiles form and gets the information I want. Now I want to do the same without open a IE session. I have written some code and I reach the aim to login and "navigate" to the next page but i can't go on. I think it's a problem with LTPA token. I asked before on the forum a more generic post. Here is my code ' Takes

access denied in browser (IE8) when I try to retrive xml file

和自甴很熟 提交于 2019-12-13 03:11:46
问题 I have the following <script type="text/javascript"> if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("MSXML2.XMLHTTP"); } xmlhttp.open("GET","test.xml",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; And then the file continues with other stuff... The problem is that I get an error on the line with xmlhttp.open which says Access Denied in IE 8. I run all this files locally and

Get URL Referer and Origin header from Microsoft Bot Framework

谁说胖子不能爱 提交于 2019-12-13 02:52:00
问题 I am using a directline inside my website, I was wondering if there is anyway to tell the URL of the website from the Request header Referrer and Origin, I want to get the value inside a Dialog, I have tried using Activity.ServiceUrl but it is giving directline.botframework.com and the HttpContext.Current.Request.Url.AbsoluteUri is giving the Azure URL. public Task StartAsync(IDialogContext context) { context.Wait(MessageReceivedAsync); return Task.CompletedTask; } private async Task

ie save onunload bug

徘徊边缘 提交于 2019-12-13 02:43:04
问题 I have a dynamic ajaxy app, and I save the state when the user closes the explorer window. It works ok in all browsers but in IE there is problem. After I close twice the application tab, i can't connect anymore to the server. My theory is that the connection to the server fail to complete while the tab is being closed and somehow ie7 thinks that it has 2 outstanding connections to the server and therefore queues new connections indefinitely. Any one has experienced this, any workaround or