weixin_33704234 2015-03-03 14:47 采纳率: 0%
浏览 47

Ajax和Node.js出现问题

I am having a problem that has me perplexed.

I have a simple webpage that works using php and mysql. I am trying to conver this to node.js and mysql.

There are 2 dropdown select boxes the first contains a list of customers that is taken from the database. (This works well)

when a customer is selected I need the second box to contain a list of instruments that belong to the customer.

I have this working great in the php version but in the node.js version the second dropdown does not get up[dated and the console has and error that states Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.

Does this mean I can not use this code or better yet how do I change this script to make it work properly??

$(document).ready(function(){ 

$("select#cust").change(function(){
var cust_id =  $("select#cust option:selected").attr('value'); 
var test =  $("#test").val();
var din = $("#idate").val(); 
$("#inst").html( "" );

if (cust_id.length > 0 ) { 
$.ajax({
        async: true,
        type: "GET",
        async: true,
        url: "fetch_inst",
        data: "cust_id="+cust_id,
        cache: false,
        beforeSend: function () { 
            $('#inst').html('<img src="loader.gif" alt="" width="24" height="24">');
        },
        success: function(data) {    
            $("#inst").html( data );

        }
    });

     }
});
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
    • ¥15 C# datagridview 单元格显示进度及值
    • ¥15 thinkphp6配合social login单点登录问题
    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配