JQuery: 'Uncaught TypeError: Illegal invocation' at ajax request - several elements

后端 未结 8 1204
醉话见心
醉话见心 2020-11-27 03:38

I have two select elements, A and B: when A\'s selected option changes, B\'s options must be updated accordingly. Each element in A implies many elements in B, it\'s a one-t

8条回答
  •  情书的邮戳
    2020-11-27 03:51

    I've read in JQuery docs that data can be an array (key value pairs). I get the error if I put:

    This is object not an array:

    var data = {
            'mode': 'filter_city',
            'id_A': e[e.selectedIndex]
    };
    

    You probably want:

    var data = [{
            'mode': 'filter_city',
            'id_A': e[e.selectedIndex]
    }];
    

提交回复
热议问题