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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 有偿寻云闪付SDK转URL技术
    • ¥30 基于信创PC发布的QT应用如何跨用户启动后输入中文
    • ¥20 非root手机,如何精准控制手机流量消耗的大小,如20M
    • ¥15 远程安装一下vasp
    • ¥15 自己做的代码上传图片时,报错
    • ¥15 Lingo线性规划模型怎么搭建
    • ¥15 关于#python#的问题,请各位专家解答!区间型正向化
    • ¥15 unity从3D升级到urp管线,打包ab包后,材质全部变紫色
    • ¥50 comsol温度场仿真无法模拟微米级激光光斑
    • ¥15 上传图片时提交的存储类型