weixin_33736649 2012-11-19 07:29 采纳率: 0%
浏览 354

路径中包含非法字符?

I have following scripts:

function PostChartValues(meter_id, range_type_id, start_date, end_date) {
    $.ajax({
        url: '@Url.Action("GetMeterReadingsTimeSeries", "Widget")',
        type: 'POST',
        data: { MeterType: meter_id, DateRangeType: range_type_id, StartDate: start_date, EndDate: end_date },
        beforeSend: function () {
            $("#chart_loading_div").show();
        },
        complete: function () {
            $("#chart_loading_div").fadeOut();
         },
        success: function (result) {
            $("#chart").html(result);
        },
        error: function (result) {
            alert("Seçilen kritere uygun veri bulunamadı!");
        }
    }); //end ajax
} //end PostChartValues

code is working. But When I receive an external .js file above code, I get the error that I wrote in the title.

Why do I get this?

  • 写回答

2条回答 默认 最新

  • 谁还没个明天 2012-11-19 07:36
    关注

    You have asp.net code in there, asp.net-mvc doesn't parse external js files so you'll actuall be trying to make a request to @Url.Action("GetMeterReadingsTimeSeries", "Widget") which is not a valid url. You'll have to manually write the results of Url.Action("GetMeterReadingsTimeSeries", "Widget") in you js file.

    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试