weixin_33739646 2017-02-07 17:42 采纳率: 0%
浏览 19

Ajax调用永远不会执行

I got a simple php page that executes a Jquery script as follows:

SCRIPT part:

    <script>
     $(document).ready(function(){
          $(".ajax_link").mouseover(function(){
               sfpRx($(this).text());
          });
     }

    function sfpRx(sfp){
        console.log("sfpRx Was executed");
        $.ajax({
            type: "GET",
            url: "/NOKIA/sfp-load.php?sfp="+sfp,
            async: true,
            dataType: "text",
            timeout: 5,
            success: function(data){
                console.log(data);
            }
        });
    }
    </script>

HTML part:

<td class="ajax_link">3FE62600AA</td>

sfp-load.php content:

<?php echo $_GET['sfp'];?>

Explanation: everytime I mouse over the HTML part on the page, it executes the sfpRx() function that makes an ajax call to sfp-load.php. This Php page should return "3FE62600AA" to the ajax call, which should get printed in the console.

Problem: the "3FE62600AA" never gets printed in the console but I'm certain that the sfpRx() function is called because it prints "sfpRx Was executed" in the console. What could be happening? Am i forgetting anything? I'am sure the sfp-load.php page is in the NOKIA/ folder. I'am really annoyed with this.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料
    • ¥15 使用R语言marginaleffects包进行边际效应图绘制
    • ¥20 usb设备兼容性问题
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办
    • ¥15 vue2登录调用后端接口如何实现