【问题标题】:how to check this codeigniter php function working or not that function using in ajax url如何检查这个codeigniter php函数是否在ajax url中使用
【发布时间】:2015-04-06 06:18:50
【问题描述】:

我的脚本代码:

    <script type="text/javascript">
function changebox(curval,datashow){
    alert(curval);
    $.ajax({
    type:"POST",
    data:"del="+curval,
    url:"<?php echo site_url('grocery/add_to_show');?>",
    success: function(html){
        $('#'+datashow).html(html);
    }
});
}
</script>

url包含php函数

url:"<?php echo site_url('grocery/add_to_show');?>",

那么我如何确认这个 PHP 函数正常工作而不返回任何错误

请给出解决这个问题的方法

【问题讨论】:

  • 如果您查看页面源代码,您可以看到返回该 php 函数的内容。要查看 ajax 请求,请使用几乎所有浏览器中提供的开发人员工具。
  • 您可以在 ajax 调用时回显您在 php 函数中执行的查询或提醒 ajax 响应以查看结果
  • 您可以检查您的浏览器控制台和网络以检查 url 是否正确以及您从 ajax 请求中得到什么响应
  • 是的,我检查了脚本返回没有错误
  • 如果显示ststus 200,您可以在浏览器网络中检查它,然后一切正常..

标签: javascript php ajax codeigniter


【解决方案1】:

在 javascript 中使用 alert that php 代码,您可以轻松了解它返回的值。

【讨论】:

  • 你可以在评论中这样说..这不是答案它只是建议
【解决方案2】:

确保您的 firebug 控制台选项卡(或 chrome 控制台)已打开。如果发生任何错误,您将看到所有信息。

【讨论】:

  • 是的,我检查了脚本完美运行,没有返回任何错误
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-24
  • 2021-06-25
  • 2012-08-08
相关资源
最近更新 更多