我正在我的本地主机上尝试 jQTouch 演示。点击“提交”后我没有得到任何回复。我在 Google 上搜索了该问题,只找到了这个链接文本,但它不起作用。
I was trying out the jQTouch demos on my localhost. I couldn't get any response after clicking on "Submit". I Googled the problem and only found this link text but it doesn't work.
发布评论
评论(2)
只需记住在 .htaccess 文件中添加 ajax 文件(例如 ajax_post.php)即可。干杯!
Just remember to add the ajax file(such as ajax_post.php) in the .htaccess file. Cheers!
同源策略 阻止本地主机 AJAX 请求,因为请求和响应的域是不同的。要解决此问题,使用 IP 地址 、禁用该策略,或添加
Access-Control-Allow-Origin : *
响应头。The same-origin policy prevents localhost AJAX requests since the domains of the request and the response are different. To workaround this, use the IP Address, disable the policy, or add the
Access-Control-Allow-Origin: *
header to the response.