How to replace window.location.assign with ajax call

I have a button in my Application, when user click on that button, my server suppose to download a file. This entire process I have achived with following code

window.location.assign("/bi/myReport");

It's working fine, but I want to use ajax call instead of window.location. Because when user click on button I am planning to show loading process.once download done, I have to remove that. Apart from this, I can show both error and success messages.

server side code in Node.js :

res.setHeader('Content-Type','application/vnd.openxmlformats') res.setHeader("Content-Disposition","attachment; filename=test.csv"); res.end(result, 'binary');

with window.location, I am unable to get any response because, whatever URL,I have mention it's not comes under current window scope.

How can I achive this.

Category:javascript Views:5 Time:2015-03-17

Related post

  • Difference between window.location.assign() and window.location.replace() 2010-12-22

    What is the difference between window.location.assign() and window.location.replace(), when both redirect to a new page? --------------Solutions------------- Using window.location.assign("url") will just cause a new document to load. Using window.loc

  • Difference between window.location.href, window.location.replace and window.location.assign 2011-10-09

    What is the difference between window.location.href="http://example.com"; window.location.replace("http://example.com"); window.location.assign("http://example.com"); I read in many forums that window.location.assign() just replaces the current sessi

  • Calling a javascript function after loading a page with window.location.assign 2011-07-08

    Is it possible to call a javascript function after loading a page with window.location.assign? I have this code. <script language="javascript" type="text/javascript"> function Loadspirit(){ window.location.assign("spirituality.php"); ReadEnglis

  • What is the difference between location.replace() and location.assign() in JavaScript? 2011-08-06

    I want to know what is the difference between location.replace() and location.assign(). I looked carefully but I didn't notice any difference between them! --------------Solutions------------- location.replace() goes to the page with the argument, re

  • Set window.location.hash on ajax call 2011-01-31

    i belive it is quite simple question. I am making an ajax call with jquery and all that i want is to set custom hash after the call similar to this: window.location.hash = '?url=http://www.sitename.com'; but it returns # symbol before that and i dont

  • window.location change fails AJAX call 2010-02-12

    I've got a click tracking AJAX function (calls a WebMethod on an .aspx page), and I need to call it when the user clicks through to a link. Unfortunately, I'm using window.location = "newUrl" to change the page, which seems to make the AJAX call fail

  • possible to replace window.location.hash? 2010-07-31

    I'm wondering whether it's possible to change the hash in window.location.hash and replace it with 'this.id'. Or would I need to change the entire window.location? --------------Solutions------------- Yes, you can. I do something similar at one of my

  • Cannot replace window.location with vista IE8 2014-05-24

    We have a web app that has been working for 10 years on various browsers. One of the operations causes a redirect of the page using "window.location.replace(newUrl)". It was working fine on IE7 and it works on IE8 on XP. However, it fails to redirect

  • JavaScript: Navigate to a new URL without replacing the current page in the history (not window.location) 2010-02-24

    I know how to use window.location. The problem is that, (at least in FF) it erases the page you are on from the history. e.g., I'm on page A, I navigate to B and window.location is used to send me to C. If on page C, I click back, I end up at A, not

  • Using windows.location.replace to refresh page not working with a hash in URL 2010-09-24

    I have an AJAX call which takes care of some server side settings (I'm using this for login, language switches, etc.). If, and only if, server side settings are actually changed as a result of this call, I want to refresh the current page (without re

  • How can I override the location.assign or location.replace functions in JavaScript? 2012-02-13

    I'm trying to override the location.assign function, so that I can ensure that the URLs set by it will always be absolute. But I can't seem to get it to work: when I use Xmlhttprequest.open as follows, it works fine: var oldOpen; oldOpen = XMLHttpReq

  • window.location.href not working :( 2011-05-24

    So i have a form, and onsubmit="return reg_check(this)" where reg_check() is a javascript function in the header which is supposed to check the form data, and since one of its tasks is to check if the username is in the database which requires php, i

  • windows.location.href not working on Firefox3 2008-11-08

    We have a JavaScript function named "move" which does just "windows.location.href = any given anchor". This function works on IE, Opera and Safari, but somehow is ignored in Firefox. Researching on Google doesn't produce a satisfactory answer why it

  • JS: Redirecting with 'window.location' not saving history in Firefox 2011-02-16

    I'm trying to redirect without losing the history in Firefox. I have used the next without success: window.location = "http://example.com"; window.location.href = "http://example.com"; window.location.assign("http://example.com"); Also tried using 'd

  • window.location = #anchor doesn't work in IE 2009-07-23

    On this map: http://web.pacific.edu/documents/marketing/campus-map/version%202/stockton-campus-2.0.htm I have an anchor at the top, and I want the page to jump to the anchor when a link is clicked. I'm currently using window.location = '#top'; It wor

  • window.location Does Not Work on Chrome Browser 2010-02-27

    I have a javascript function that uses window.location. It works fine in Firefox and internet Explorer, but not in Chrome. I've tested this on both Ubunutu Hardy and Windows Vista. What is the underlying problem, and how can I circumvent it? --------

  • Javascript for conditional URL append or redirect based on window.location.href 2010-04-05

    I am trying to make a bookmarklet that when clicked will check the URL of the current tab/window to see if it contains 'char1' and/or 'char2' (a given character). If both chars are present it redirects to another URL, for the other two it will append

  • window.location.href in firefox 2010-11-19

    Can you please tell me why window.location.href is not working on firefox? Code: <script> function goToURL() { window.location.href('url'); } </script> What can I use instead of window.location.href as an alternative? --------------Soluti

  • How to set window.location on localhost including a hash mark under IE 8 2011-07-23

    I've got a bookmarklet which is meant to change the current URL. The code is: javascript:location.href = 'http://localhost:8888/#nominate' However, under IE8 this ends up sending the browser to: http://localhost:8888/ How do I send IE8 to that hashma

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.175 (s). 11 q(s)