这是相当困难的,帮助你因你没有给我们具体的“系统”, 任何信息,你说我们的事你的cdn api ..但它是我们需要知道的不太有用的东西
所以我假设你不知道该怎么办,这里是一个普通的方法
我们的云框架意味着我们无法直接从 网站访问文件,但我可以直接包含它们。
,所以你只需要一个PHP包装来调用这些“包括”,让你的数据
// read your args and if need sanitize them
$id = $_POST['link']; // read your args
// do the job and get/generate your data
$mydata = get_responses($id, ... your api ...);
//if you need json or anything else, it's now
$mydata = json_encode($mydata);
// here print/die the data
die($mydata); // echo and return
?>
在JavaScript端,你将调用包装与所需的信息, 取决于从哪里启动该活动,您存储所需的信息
这里的一个例子,我假定这就是所谓的点击经典锚标记,并使用HREF作为args作为脚本
HTML:
的jQuery:
// catch all anchor click
$(document).on('click','a',function(event){
var $this = $(this); // current clicked anchor as a jquery object
var href = $this.attr('href'); // get the link href
// construct your ajax args
var ajaxArgs = { link:href, hello:"world" };
/* made an ajax call by jQuery, here i use post, check jQuery documentation */
$.post('/my_php_ajax_listener.php', ajaxArgs, function(dataReturnByPhp){
/* if here ajax has terminated, do anything with the data,
* here we will fill #content html node with the data, assume data is here pure html */
$("#content").html(dataReturnByPhp);
});
event.preventDefault(); // no real click please
});
好运