i'm creating a function that i wanna use as class on javascript. My function, will call an JSON page create with php parse json, and set the vars, but it doesen't work. May you can give me some hints? Here's the code, thx in advance:
function SiteParams(){
$.getJSON("parse/parametri.php",function(data){
$.each(data,function(index,value){
this.NomeSito = value.nomesito;
this.URLSito = value.urlsito;
this.EmailAutore = value.email;
this.NomeAutore = value.nomeautore;
});
});
}
var website = new SiteParams();
function ModuleBase(){
$("<div/>",{id:"title", text:website.NomeSito}).appendTo("#main");
}
this.sito.nomewould make more sense thanthis.NomeSitoparse/parametri.phpreturn? Can you show an example? Why are you iterating over thedata? You'll only get the last result