【问题标题】:using ajax url to call php file [closed]使用ajax url调用php文件[关闭]
【发布时间】:2020-10-23 21:33:12
【问题描述】:

似乎无法将 ajax url 连接到 php 文件。多年来我一直在摆弄。

JavaScript的文件路径:h******ze.com/public_html/wp-content/themes/buddyboss-theme-child/assets/js

需要链接到PHP文件路径:

h******ze.com/public_html/wp-content/plugins/buddyboss-platform/bp-templates/bp-nouveau/buddypress/activity/user-duration.php

setInterval(function(){ 

$.ajax({
  url: '/public_html/wp-content/plugins/buddyboss-platform/bp-templates/bp-nouveau/buddypress/activity/user-duration.php',
    

  success: function(data) {
    $('.result').html(data);
  }
});

}, 3000);

【问题讨论】:

  • 您是否真的在您的网址中使用了public_html 前缀?这似乎是指向 Web 根目录的本地文件系统路径。

标签: php ajax path


【解决方案1】:

假设网站在 h??????ze.com 而不是 h??????ze.com/public_html 上可见,您的 URL 应该是 /wp-content/plugins/buddyboss-platform/bp -templates/bp-nouveau/buddypress/activity/user-duration.php

public_html 是您网站的根目录,其中包含 index.php,因此您需要将其指向那里。浏览器无法访问您正在使用的 URL 中在此之前的任何内容。

【讨论】:

    猜你喜欢
    • 2023-03-23
    • 1970-01-01
    • 2021-01-17
    • 1970-01-01
    • 2013-02-22
    • 2014-06-26
    • 2016-07-07
    • 2013-05-04
    • 1970-01-01
    相关资源
    最近更新 更多