php ajax学习
2014-02-21 22:09
232 查看
var table = document.getElementById("tableadd");//table的用法 for(var i = 1;i <= table.rows.length;i++) var tr = table.rows[i]; function trimStr(str){return str.replace(/(^\s*)|(\s*$)/g,"");} explode(",",$_POST['name']);分割字符串第一参数为分割标志 file_get_contents("php://input"); 可以获取post方法传送的原始文本传递长文本就不用担心了 //post方法上传信息 //获取http对象
function GetXmlHttpObject(){ var xmlHttp=null; try{ // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e){ //Internet Explorer try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } //查看http请求是否成功 function checkhttp(){ var http=GetXmlHttpObject() if (http==null){ error(); return null; } return http; }
function getcontent(){ gethttp = checkhttp(); if(gethttp == null) return 0; var url; gethttp.onreadystatechange=getover; gethttp.open("POST",url,true); gethttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); gethttp.send(null); } function getover(){ if (gethttp.readyState==4 || gethttp.readyState=="complete") { document.getElementById("Introduce").innerHTML = gethttp.responseText; } }
相关文章推荐
- PHP支付宝接口RSA验证
- 在PHP语言中使用JSON
- PHP函数 mysql_connect()连接MySQL数据库错误的解决办法
- PHP设计模式之工厂模式(权限分配)
- PHP的接口类(interface)和抽象类(abstract)的区别
- PHPCMS V9后台删除验证码方法
- PHP libxml RSHUTDOWN安全限制绕过漏洞(CVE-2012-1171)
- PHP glob() 函数
- PHP遍历邮箱获取邮件内容
- thinkphp 包含外部js文件,css文件方法
- PHP中$_FILES的使用及注意事项
- get_called_class — 后期静态绑定("Late Static Binding")类的名称
- PHP设计模式之单例模式(数据库访问)
- php session原理
- server2003FTP服务器
- PHP乱入,post,mysql连接,抓取网页
- 利用phpmailer发送验证邮件 注册会员
- php rpm 安装顺序 和 依赖关系
- vsftpd本地用户登录密码错误的解决方法
- PHP错j解析:Warning: Cannot modify header information - headers already sent by ...