随笔分类 -  Ajax

摘要:利用FormData实现附件上传(两种方式)var reg=document.getElementById(’reg’);var fd = new FormData(reg);send(fd); // fd里边有普通表单信息和附件信息第二种方式var mypic = document.getElem... 阅读全文
posted @ 2014-07-17 15:09 自学it技术 阅读(490) 评论(0) 推荐(0)
摘要:向服务器ajax传入数据可以:1.利用dom获取表单值传入(f1) 2.利用FormData发送传递ajax数据(f2)(没有form表单,这使用append()方法添加数据参考f3) 用户名: 密码: 邮箱: 阅读全文
posted @ 2014-07-17 14:15 自学it技术 阅读(986) 评论(0) 推荐(0)
摘要:首先在php页面生成xml文档并输出,然后在js中处理xml数据: var xhr = createXhr(); xhr.onreadystatechange = getinfo; xhr.open("get",'./07.php'); xhr.send(n... 阅读全文
posted @ 2014-07-17 13:31 自学it技术 阅读(540) 评论(0) 推荐(0)
摘要:在php生成json数据(json_decode())参数为索引数组生成的数据格式为js数组$fruit = array('apple','banana','pear','orange');$fruit_jn = json_encode($fruit); //['apple','banana'... 阅读全文
posted @ 2014-07-17 10:16 自学it技术 阅读(381) 评论(0) 推荐(0)
摘要://创建Ajax对象(兼容处理)function createXHR() { var xhr = null; if(window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else if(window.Active... 阅读全文
posted @ 2014-07-15 14:01 自学it技术 阅读(168) 评论(0) 推荐(0)