Jquery Autocomplete - 如何在自动完成时将所有数据发送到php文件

时间:2022-12-08 20:11:33

I have a problem on this tutorial.
http://www.script-tutorials.com/autocomplete-with-php-jquery-mysql-and-xml

我在本教程中遇到了问题。 http://www.script-tutorials.com/autocomplete-with-php-jquery-mysql-and-xml

I have 2 inputs:

我有2个输入:

<input id="ra" type="text" autocomplete="off">
<input id="rb" type="text" autocomplete="off">

I want to send the data of the 2 inputs to a .php file while an input is being typed in or during autocomplete like this:

我想在输入输入时或在自动完成期间将2个输入的数据发送到.php文件,如下所示:

 $('#ra).autocomplete('data.php?mode=ra&rb='+$('#rb').val(), {
        width: 200,
        max: 5
    });

 $('#rb).autocomplete('data.php?mode=rb&ra='+$('#ra').val(), {
        width: 200,
        max: 5
    });

But it's not working, how can I make this work? Thanks.

但它不起作用,我怎么能让这个工作?谢谢。

1 个解决方案

#1


0  

Your selectors are wrong.

你的选择器错了。

Try this

 $('#ra').autocomplete('data.php?mode=ra&rb='+$('#rb').val(), {
        width: 200,
        max: 5
    });

 $('#rb').autocomplete('data.php?mode=rb&ra='+$('#ra').val(), {
        width: 200,
        max: 5
    });

#1


0  

Your selectors are wrong.

你的选择器错了。

Try this

 $('#ra').autocomplete('data.php?mode=ra&rb='+$('#rb').val(), {
        width: 200,
        max: 5
    });

 $('#rb').autocomplete('data.php?mode=rb&ra='+$('#ra').val(), {
        width: 200,
        max: 5
    });