当前位置:Gxlcms > PHP教程 > $.post('index.php?act=q&openid=<?phpecho$openid;?>',{'qnumber':qNumber},functi

$.post('index.php?act=q&openid=<?phpecho$openid;?>',{'qnumber':qNumber},functi

时间:2021-07-01 10:21:17 帮助过:31人阅读

$.post('index.php?act=q&openid=',{'qnumber':qNumber},function(data){},'json');其中的index.php就是当前页面吗?还是提交JSON的那个页面?


回复讨论(解决方案)

index.php 应该就是当前页面
但对于初学者来说,最好不要是当前页面
因为 ajax 需要处理返回的数据,尤其是你还要求返回 json
这种情况下,php 处理程序不分开的话,很容易达不到要求

你的index.php应该是个入口文件,根据act分发到子页面来出来你的post数据

index.php是一定提交的页面。
但也可能是当前页面。因为可以提交给自己的。
建议改其他较好,这样容易排错。

人气教程排行