购物便宜的网站有哪些,家居企业网站建设讯息,企业网站建设三网合一,门户网站建设技术方案各位新年快乐,俺把俺写的东西拿出来秀秀,希望大家可以指点一下.原文出处:http://hi.baidu.com/tangtou/blog/item/603a24384674b120b8998f1f.html需要用到的文件有:ajax1.js 在本博客的另一篇文章里,点这里查看它json.js(请到网上下载 http://www.json.org/)json.class.php (请…各位新年快乐,俺把俺写的东西拿出来秀秀,希望大家可以指点一下.原文出处:http://hi.baidu.com/tangtou/blog/item/603a24384674b120b8998f1f.html需要用到的文件有:ajax1.js 在本博客的另一篇文章里,点这里查看它json.js(请到网上下载 http://www.json.org/)json.class.php (请到网上下载 http://www.json.org/)ajax.htmvar param’str{name:杨庆荣,age:24}’;//paramencodeURIComponent(param);urlajax.php;ajax_post(url,param,back); //当用ajax_post时,如果用encodeURIComponent(param);会得到错误结果function back(res){var objres.parseJSON(); //使用的是json.js自定义的方法alert(Name:obj.name,age:obj.age);}ajax.php//header(Content-Type:typetext/html;charsetgb2312);require_once(’json.class.php’); //这个类请到网上去下载$json new Services_JSON(); //创建一个实例$str$_POST[str];$strstripslashes($str);$strstripslashes($str);$obj$json-decode($str);$name$obj-name;$age$obj-age;class Student{var $name;var $age;function Student($name,$age){$this-name$name._From Server;$this-age$age._From Server;}}$stunew Student($name,$age);$value$json-encode($stu); //把$p1转为json字符串print_r($value);?人打赏0人 点赞主帖获得的天涯分0举报 |楼主|楼主发言1次 发图0张 | 添加到话题 |