How to encode a query string so that it is the value of another query string in javascript?

后端 未结 4 946
我在风中等你
我在风中等你 2020-12-28 13:15

I have a javascript function which passes as a query string value another query string.

In other words, I want the query string to be:

http://www.so         


        
4条回答
  •  不知归路
    2020-12-28 13:17

    function downloadFile(){
          var filePath = "C:/Users/HP/Desktop/Project Folder/DemoProject/";
    
          var fileInfo = "Error_Issue Minor Cosmetic & Major Fatal Issues (Demo_Project) (2017)_GeneratedOn_12_21_2017 21924 AM.xlsx";
          if((filePath != undefined && filePath.length > 0) && (fileName != undefined && fileName.length > 0)){
            var downloadUrl = "../download?fileName="+encodeURIComponent(fileName)+"&filePath="+encodeURIComponent(filePath);
            $window.location = downloadUrl;
          }else{
            alert("Please define a fileName for downloading...");
          }
    }
    

提交回复
热议问题