Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/412.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 Winjs.xhr、Visual Studio和脱机服务器_Javascript_Visual Studio 2013_Winjs - Fatal编程技术网

Javascript Winjs.xhr、Visual Studio和脱机服务器

Javascript Winjs.xhr、Visual Studio和脱机服务器,javascript,visual-studio-2013,winjs,Javascript,Visual Studio 2013,Winjs,我来这里是因为我的VisualStudio上有个bug。我用Javascript为Windows 8.1创建了一个Windows应用商店应用程序,我在visual studio中遇到了一些问题 以下是脚本: login.html <div class="login"> <input type="text" name="username" id="inputUsername" placeholder="Username" required&

我来这里是因为我的VisualStudio上有个bug。我用Javascript为Windows 8.1创建了一个Windows应用商店应用程序,我在visual studio中遇到了一些问题

以下是脚本:

login.html

        <div class="login">
            <input type="text" name="username" id="inputUsername" placeholder="Username" required><br />
            <input type="password" name="password" id="inputPassword" placeholder="Password" required><br />
            <button onclick="login()">Ok</button>
        </div>
问题如下:当我关闭localhost服务器并启动登录函数时,VisualStudio的调试器崩溃,并且没有告诉我有关javascript错误或其他信息。。。 如果localhost处于打开状态,则调试器工作正常

有人有办法吗

谢谢


Oxyno zeta实际上,这是javascript中的一个bug。Visual studio不喜欢错误的函数调用。 对不起

谢谢

氧泽塔

function login() {
    var body = {};
    body.name = document.getElementById("inputUsername").value;
    body.password = document.getElementById("inputPassword").value;

    var promise = WinJS.xhr({
        type: "POST",
        url: "http://localhost:598/session",
        data: JSON.stringify(body),
        responseType: "json",
        headers: { "Content-Type": "application/json" }
    }).done(
        function completed(result) {
            var response = JSON.parse(result.responseText);
            console.log(response);
        },
        function error(error) {
            console.log(error);
        }
    );
};