欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ajax獲取php頁(yè)面的返回參數(shù),控件賦值的方法

 更新時(shí)間:2016年10月15日 12:38:46   投稿:jingxian  
下面小編就為大家?guī)硪黄猘jax獲取php頁(yè)面的返回參數(shù),控件賦值的方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧

js頁(yè)面

$.ajax({
type : "get",
url : "", //跳轉(zhuǎn)頁(yè)面
data :"m=content&c=favorite&a=del_favorite&shoucangId="+_id,//傳遞的參數(shù)
datatype : "html",
async:'false',
success : function(data) //返回值
{  if(data !=null)
   {
 var str= new Array(); //定義一數(shù)組
 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頁(yè)面

$shoucangId=$_GET['shoucangId'];//獲取傳遞的參數(shù)
$where="ID='$shoucangId'";
$signalInfo=array();
$signalInfo=$this->db->get_one($where,'*','',''); //此處借用PHPCMS二次開發(fā)的例子,select數(shù)據(jù)庫(kù)中的一個(gè)數(shù)據(jù)集,存于數(shù)組$signalInfo中
if($signalInfo!=null)
{
 $str=$signalInfo['title'].",".$signalInfo['url'].",".$signalInfo['type'].",".$signalInfo['id'];//將要返回的數(shù)組用逗號(hào)拼接成字符串返回
 exit($str);
}
else
{
 exit('0');
}

以上就是小編為大家?guī)淼腶jax獲取php頁(yè)面的返回參數(shù),控件賦值的方法全部?jī)?nèi)容了,希望大家多多支持腳本之家~

相關(guān)文章

最新評(píng)論