发送一个Jquery AJAX请求,但在PHP端接收多个请求

发送一个Jquery AJAX请求,但在PHP端接收多个请求,php,jquery,ajax,Php,Jquery,Ajax,我已经研究了几十个答案,但没有找到解决办法 我在mouseover上调用了jqueryajax。 我在浏览器控制台中看到一个日志。 但PHP端收到2个请求 我的JS代码: $('.df_word').off("mouseover").on("mouseover", function(){ console.log("open translation_box"); //fires once on hover get_translation($(this),$(this).html()

我已经研究了几十个答案,但没有找到解决办法

我在mouseover上调用了jqueryajax。 我在浏览器控制台中看到一个日志。 但PHP端收到2个请求

我的JS代码:

$('.df_word').off("mouseover").on("mouseover", function(){
    console.log("open translation_box"); //fires once on hover
    get_translation($(this),$(this).html());
}

function get_translation(word_el,word_html){
    console.log('get_translation'); //fires once on hover

    var params = {}
    params['api'] = "2.0";
    params['page'] = "translate";
    params['q'] = ""+word_html+"";

    console.log(params); //fires once on hover
    $.ajax({
        type: "GET",
        crossDomain: true,
        contentType: 'application/json; charset=utf-8',
        url: window.api_link,
        data: params,
        error: function( xhr, textStatus ) {
            console.log(xhr.status);
        },
        success: function(data){
            console.log(data); //fires once on hover
        }
    });
}
在PHP方面,我在同一秒内看到2个请求(我将每个请求保存到数据库)


我缺少什么?

他们都是
GET
请求吗?第一个可能是
OPTIONS
请求,因为这是跨域的。您确定在浏览器控制台中只收到一条日志消息吗?有时,它们显示为一条消息,带有一个数字,表示收到同一消息的次数。@Martineralecký是的,100%确定。只有一个。@Barmar是的,我看到了<代码>类型:关注这一点。这对于跨域AJAX来说是正常的,它是CORS协议的一部分。