vendredi 28 juillet 2017

refer element to show an object Jquery

I hope you can help me with this one. I want to refer an element to object. How can I do that.

the situation is like this. I got this

MatchItem

Properties

Name    Type
Id  string
MatchNumber int
Date    string
Time    string
DepartmentId    string
DepartmentCode  string
DepartmentName  string
HomeTeamId  string
HomeClubId  string
HomeTeam    string
AwayTeamId  string
AwayClubId  string
AwayTeam    string
PoolId  string
PoolName    string
PoolCity    string
MatchReport string
Played  boolean
ResultHome  int
ResultGuest int
Referees    MatchRefereeItem[]

through jquery, I called an action from the DOM.

if(data.Action == "D") {
                    element.html('<td>'+ standings.H +'-'+ standings.G +'</td>' + '<td>' + data.Time +'</td>'+ '<td>' + participant.Name + ' ' + translateAction(data.Action) + '</td>' + '<td>' + participant.Team + '</td>');
                } else {
                    element.html('<td></td>' + '<td>' + data.Time +'</td>'+ '<td>' + participant.Name + ' ' + translateAction(data.Action) + '</td>' + '<td>' + participant.Team + '</td>');
                }

its about the participant.Team the results shows H or G (home or away team) but it has to refer to HomeTeam or AwayTeam. How do I do that? or where...in php or jquery?

so far I got this in jquery.

if(participant.Name == "H"){
                    element.html('<?=$Match->HomeTeam?>');
                }else{
                    element.html('<?=$Match->AwayTeam?>');
                }

thanks again!

Aucun commentaire:

Enregistrer un commentaire