如何使用Ajax调用php脚本 [英] How to call php script using Ajax

查看:62
本文介绍了如何使用Ajax调用php脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在服务器上使用XMLHttpRequest调用php脚本

header('Access-Control- Allow-Origin:*')以便可以访问。它在Chrome和Firefox上工作正常,但它不适用于IE8和IE 9.它提供 TypeError:访问被拒绝。 。请告诉我解决此问题的最佳方法是什么。



Rgds

SNI

Hi,

I am calling php script using XMLHttpRequest from my server with
header('Access-Control-Allow-Origin: *') so that it can be access. It is working fine on Chrome and Firefox but it not working on IE8 and IE 9. It gives "TypeError: Access is denied.". Please let me know what is the best approach to resolve this issue.

Rgds
SNI

推荐答案

请参考以下链接

http://www.w3schools.com /ajax/ajax_aspphp.asp [ ^ ]



希望这样可以解决你的问题...
Please refer below link
http://www.w3schools.com/ajax/ajax_aspphp.asp[^]

hope so this will solve your problem...


为什么不试试jquery ...



它几乎可以节省您的时间



Why dont you try jquery for this...

It would pretty much save your time


.post( ajax / test.php,function(data){
// data是你作为输出返回的东西
.post( "ajax/test.php", function( data ) { //"data" is some thing what you return as a output


这篇关于如何使用Ajax调用php脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆