weixin_33730836 2018-02-21 22:10 采纳率: 0%
浏览 39

函数内部的Ajax调用

I am working inside of an Oracle package. I am trying to use an AJAX call to call a procedure from a button click. The ajax call is inside of a function. I am not getting any syntax errors from Oracle or when I'm using the browsers debug mode so I'm not sure what the problem is. Function is below.

htp.p('
function ApplyTest(_ht) {
     var _inst  = "";
     var _pidm = '||v_web_pidm||';
     var _inst = document.getElementById("Test").value;
        alert("Heat Ticket value is: " + _ht);
        alert("the instance is: " + _inst);
     var resp = confirm("Are you sure you want patch applied to TEST8?");
     if (resp == true) { 
        alert ("user pidm is: " + _pidm);

        return $.ajax ({
             type: "POST",
             cache: false,
             dataType: "json",
             url: "gyapatch.p_update",
             data: {"v_instance" : _inst, "v_ht" : _ht},
             success : function(data) { alert("success"); }
        });

        alert("Got here");
        alert("value: " + _inst);

        window.location.reload;
        alert("got to the end");
     } else {
        return;
     } 
   } 
');

code for the button is:

<button name="TestApply" id = "Test" onclick="ApplyTest('||val_patch.heat_ticket||')" type="button" value="T">Apply to TEST8</button>'

When I try to return the ajax call nothing is happening and I can't even reach the "Got Here" alert. When I remove the "return" keyword, I can reach the alerts but either way, nothing is happening. GYAPATCH.p_update is the package/procedure I wish to have executed when this is ran

I'm not sure what the problem is. Any help on this would be greatly appreciated. Thanks in advance.

  • 写回答

1条回答 默认 最新

  • weixin_33670713 2018-02-23 00:42
    关注

    So after a couple of hours, I had figured out the problem. This was more of a learning lesson as the issue was pretty simple. I needed to remember that I was working inside of an Oracle database AND also using WebTailor. The code posted above is correct. It turns out that the procedure I was trying to call (p_update) was not registered.

    WebTailor allows you to build web applications utilizing Banner. In WebTailor, any pages that are used (usually stemming from a package.procedure), need to be registered or else they are not recognized.

    I found this while debugging. Under the Network tab in my debugger, I noticed that when I click my button, I am getting a 404 error when my package.procedure is called. So I then realized it couldn't find my package and then proceeded to check if it was registered. This was a simple, silly error on my part. I am grateful for the feedback, but this will probably serve as a learning lesson or reminder to anyone trying to use ajax while working with Banner data.

    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置