在按钮单击时进行ajax调用时,找不到错误404

时间:2016-09-28 05:11:52

标签: javascript ajax asp.net-mvc-4 razor

我已经编写了以下函数来执行按钮单击时的ajax调用:

function callPrint() {
        var PrintCssContent = "";
        //$.get("/App_Themes/@siteContext.UI.Theme/Print.css", function(cssContent){
        //    PrintCssContent = cssContent;
        //});

        $.ajax({
            url: "/Areas/Travel/Controllers/Itinerary/GetHtmlString",
            dataType: "text",
            success: function (cssText) {
                PrintCssContent = cssText;

                var DivMainContent = document.getElementById('mytrip');
                var DivEdit = document.getElementById('divEdit');
                var divlink = document.getElementById('divlink');

                var WinPrint =
                window.open('', '', 'width=auto,height=auto,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes');
                WinPrint.document.write("<html><head><style>" + PrintCssContent + "</style> </head><body>");
                //WinPrint.document.write("<html><head><style> table.faressvcsShorter {background: none repeat scroll 0 0 #FFFFFF;border: 1px solid #CCCCCC;border-collapse: collapse;margin: 5px;width: 95%;}</style> </head>");

                //divlink.style.display = 'none';
                //WinPrint.document.write(DivEdit.innerHTML.toString());
                //divlink.style.display = 'block';
                WinPrint.document.write("<div class='clear10px'></div><div class='split'></div>");
                WinPrint.document.write(DivMainContent.innerHTML.toString());
                WinPrint.document.write("</body></html>");
                WinPrint.document.close();
                WinPrint.focus();
                WinPrint.print();
                WinPrint.close();
            }
        });
        return false;
    }

我的行动方法正在走下去; \领域\旅行\视图\行程\ GetHtmlString

我的页面中有一个按钮,我正在执行onclick方法来进行ajax调用 但它没有找到404#34;&#34;控制台错误。 有什么解决方案吗?

0 个答案:

没有答案