Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将数据保存到本地文本文件_Javascript_Jquery - Fatal编程技术网

Javascript 将数据保存到本地文本文件

Javascript 将数据保存到本地文本文件,javascript,jquery,Javascript,Jquery,上面的脚本从网站中提取地址、电子邮件和电话号码。如何将我拉入的数据保存到文本文件中 我正在尝试这样做,但没有使用点击事件的权限。据我所知,Firefox和Chrome都不要求在链接文章的saveTextAsFile中运行代码以响应用户事件。(这很可怕,几乎可以肯定是一个bug。)因此,只需修改示例,就可以从ajax完成处理程序中调用saveTextAsFile。“我正在尝试这样做,但没有使用单击事件”的问题,因此必须是独立的。如果你要提到问题之外的东西,你必须在问题中总结它。 // Querie

上面的脚本从网站中提取地址、电子邮件和电话号码。如何将我拉入的数据保存到文本文件中


我正在尝试这样做,但没有使用点击事件的权限。据我所知,Firefox和Chrome都不要求在链接文章的saveTextAsFile中运行代码以响应用户事件。(这很可怕,几乎可以肯定是一个bug。)因此,只需修改示例,就可以从
ajax
完成处理程序中调用
saveTextAsFile

“我正在尝试这样做,但没有使用单击事件”的问题,因此必须是独立的。如果你要提到问题之外的东西,你必须在问题中总结它。
// Queries atlatlsoftware.com and returns the site in json data format, using YQL
$.ajax({
    url: "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fatlatlsoftware.com%22%20and%0A%20%20%20%20%20%20xpath%3D'%2F%2F*%5B%40id%3D%22desktop-footer%22%5D%2Fdiv%5B3%5D%2Fdiv%2Ftable%2Ftbody%2Ftr%5B2%5D%2Ftd%5B1%5D'&format=json&diagnostics=true&callback=?",
    dataType: 'jsonp',
    // upon success, logs the data as "response"
    success: function (response) {

        // simply following the json data path and assigning it to a variable
        var address = response.query.results.td.div[1].content;
        var phone = response.query.results.td.div[2];
        var email = response.query.results.td.div[3];
        // var tweet = response.query.results;

        // appends the variable to the html
        $(".address").html(address);
        $(".phone").html(phone);
        $(".email").html(email);
        console.log(address);
        console.log(phone);
        console.log(email);
        // console.log(tweet);

    }
});