手机
当前位置:查字典教程网 >编程开发 >AJAX相关 >ajax获取php页面的返回参数,控件赋值的方法
ajax获取php页面的返回参数,控件赋值的方法
摘要:js页面$.ajax({type:"get",url:"",//跳转页面data:"m=content&c=favorite&a=del_f...

js页面

$.ajax({ type : "get", url : "", //跳转页面 data :"m=content&c=favorite&a=del_favorite&shoucangId="+_id,//传递的参数 datatype : "html", async:'false', success : function(data) //返回值 { if(data !=null) { var str= new Array(); //定义一数组 str=data.split(","); //字符分割 var title=str[0]; var url=str[1]; var type=str[2]; var id=str[3]; $("#title").val(title); // jQuery控件赋值 $("#url").val(url); $("#shoucnag_id").val(id); if(type=='钢琴谱') $("input[name='radio'][value='钢琴谱']").attr("checked",true); else if(type=='钢琴曲') $("input[name='radio'][value='钢琴曲']").attr("checked",true); } else { alert('失败!');return false; } } });

PHP页面

$shoucangId=$_GET['shoucangId'];//获取传递的参数 $where="ID='$shoucangId'"; $signalInfo=array(); $signalInfo=$this->db->get_one($where,'*','',''); //此处借用PHPCMS二次开发的例子,select数据库中的一个数据集,存于数组$signalInfo中 if($signalInfo!=null) { $str=$signalInfo['title'].",".$signalInfo['url'].",".$signalInfo['type'].",".$signalInfo['id'];//将要返回的数组用逗号拼接成字符串返回 exit($str); } else { exit('0'); }

以上就是小编为大家带来的ajax获取php页面的返回参数,控件赋值的方法全部内容了,希望大家多多支持查字典教程网~

【ajax获取php页面的返回参数,控件赋值的方法】相关文章:

Ajax调用restful接口传送Json格式数据的方法

有关Ajax跨域问题的两种解决方法

javascript Ajax获取远程url的返回判断

php+ajax实现带进度条的大数据排队导出思路以及源码

Ajax Session失效跳转登录页面的方法

ie发送ajax请求返回上一次结果的解决方法

Ajax获取响应内容长度的方法

Ajax加载外部页面弹出层效果实现方法

Ajax发送和接收二进制字节流数据的方法

ajax遍历xml文档的方法

精品推荐
分类导航