麻烦与ajax和node.js

时间:2015-03-03 14:47:31

标签: jquery ajax node.js

我遇到一个令我困惑的问题。

我有一个使用php和mysql工作的简单网页。我试图将其转换为node.js和mysql。

有2个下拉选择框,第一个包含从数据库中获取的客户列表。 (这很有效)

当选择客户时,我需要第二个框来包含属于客户的工具列表。

我在php版本中工作得很好,但是在node.js版本中,第二个下拉列表没有启动[已过时且控制台有错误且状态错误 主线程上的同步XMLHttpRequest因其对最终用户体验的不利影响而被弃用。

这是否意味着我无法使用此代码或更好,但如何更改此脚本以使其正常工作?

$(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 个答案:

没有答案