jquery ajax error {“readyState”:0,“responseText”:“”,“status”:0,“statusText”:“error”}

后端 未结 4 637
逝去的感伤
逝去的感伤 2020-12-17 15:07

I am trying to do an ajax request

$.ajax({
  type: \"post\",
  url: \"download.php\",
  error: function(data, status, err){
           alert(JSON.stringify(d         


        
4条回答
  •  感情败类
    2020-12-17 15:50

    The element that was calling this was an anchor tag that would call this then download an exe file and when the file download dialog box poped up it would cancel this request as if it were navigating to a new page.

    I changed it to

    function download(fileid, href)
    {
        $.post("download.php", {task: "download", fileid: fileid}, function(data){
            window.location.href = href;
        });
    }
    
    Download
    

提交回复
热议问题