json 데이터를 클래스 변수 산업 또는 제품에 저장하도록 jQuery $ .get을 얻는 방법은 무엇입니까?
$ .get 호출에서 PHP 파일로 반환 된 데이터를 보면 jSon 배열을 반환하지만 정보를 사용할 수는 있지만 리턴 된 내용을 저장하는 것이 더 중요합니다. Profile 클래스의 글로벌 변수
Profile=new Profile("kazie.php");
Profile.getProfile(0123, 'Kayla', '[email protected]');
var Profile = function(php_file){
this.php_file=php_file;
this.serial;
this.industry;
this.product;
//Also need to access scope as well
};
Profile.prototype={
getProfile:function(serial, name, email){
$.get(this.php_file,{action: "retrieve_profile", serial: serial, name: name, email: email},
function (data){ //Return a json array of our new profile
//Data is an array of properties. array("industry"=>"Retail");
//I need to assign these properties to my global variables for
//***How to I get data["industry"] to store in Profile.industry?**
}, "json"
);
}
}