,엽차 터치 2.4.1 - 배열의 값에 geting는 JSON 문자열을 통해 전송 다음 코드는 잘 작동
는 PHP에서 보낸 //
echo("({'title':'$myTitle', 'message':'$myMessage'})");
// 엽차의 제어에서 아약스 응답 비트의 ,이 또한 수행하지만 그러나 개별 데이터를 얻을 질수 응용 프로그램
success: function(xhr,params)
{
var data = Ext.JSON.decode(xhr.responseText.trim());
var aTitle=data.title; //get the value of message, $myMessage
var aMessage=data.message;
console.log('Title:',aTitle,' - Message:',aMessage);
},
터치
// PHP에서 이전과 같은 데이터의 배열, 제목과 메시지 만 많은
$data=json_encode($myArray);
echo "({'myData':'$data'})";
// 엽차 터치 응용 프로그램의 컨트롤에서 아약스 응답 비트의
success: function(xhr,params)
{
var data = Ext.JSON.decode(xhr.responseText.trim());
var myArray=[];
Ext.Array.each(data.myData, function()
{
myArray[count]= data.myData;
//this will spit out all the data from array.
console.log('myArray contains:',myArray[count]);
//but i wanted to select individual bit e.g.(pseudo code ish)
myArray[0]=data.myData.title;
or
myArray[3]=data.myData.message; // that sort of thing
count=count+1;
});
},
그 이상 이것에 실패하면 누구나 이것을 어떻게 바꿀 수 있는지 말해 줄 수 있습니다.
// 영숫자가 아닌 charecters를 없애기 myOutputString = myDataString.replace (/ \ W/g, '');
그래서 같은 exept를 제거합니다.
그럼 내가 원하는 방식으로 데이터에서 원하는 비트를 지정할 수 있습니다 (단, preffered 옵션은 아님). L.