Hi All,
I appreciate your time in advance. I want to create a button inside the infoWindow (Popup). Ideally, users click the button('ElectricityMeter'), which calls the Ajax and display the JSON data in the Dialog (JQuery) on the map. The codes below are the snippet of my codes. It would be appreciated if you all could provide your opinions.

The workflow:
First: the new Popup, okMap is the object and the 'infoContainer' is the 'id ' for the infoWindow
okMap<SPAN class="punctuation token">.</SPAN>popup <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Popup</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
lineSymbol<SPAN class="punctuation token">:</SPAN>symbolLine<SPAN class="punctuation token">,</SPAN>
fillSymbol<SPAN class="punctuation token">:</SPAN>symbolFill<SPAN class="punctuation token">,</SPAN>
markerSymbol<SPAN class="punctuation token">:</SPAN><SPAN class="keyword token">null</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"infoContainer"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>Second: the JQuery and Ajax part inside the head within the HTML file. Here the attribute 'COMMENTS' works as the primary key (i.e. 54156635) to match the value provided by the common column name ('MeterNumber') in the 'ElecMeter.json' file. Inside the main HTML file, I also created two divs one for 'dialogs' and the other for 'EM-template'.
<SPAN class="operator token"><</SPAN>script<SPAN class="operator token">></SPAN>
<SPAN class="token function">$</SPAN><SPAN class="punctuation token">(</SPAN>document<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">ready</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> $dialogs <SPAN class="operator token">=</SPAN> <SPAN class="token function">$</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'#dialogs'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> emTemplate <SPAN class="operator token">=</SPAN> <SPAN class="token function">$</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'#EM-template'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">html</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">function</SPAN> <SPAN class="token function">emTemplateCreator</SPAN><SPAN class="punctuation token">(</SPAN>em<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
$dialogs<SPAN class="punctuation token">.</SPAN><SPAN class="token function">html</SPAN><SPAN class="punctuation token">(</SPAN>Mustache<SPAN class="punctuation token">.</SPAN><SPAN class="token function">render</SPAN><SPAN class="punctuation token">(</SPAN>emTemplate<SPAN class="punctuation token">,</SPAN>em<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="token function">$</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"div#infoContainer"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">find</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"button"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">click</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="token function">$</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"#dialogs"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">dialog</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
$<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ajax</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
type<SPAN class="punctuation token">:</SPAN><SPAN class="string token">'GET'</SPAN><SPAN class="punctuation token">,</SPAN>
url<SPAN class="punctuation token">:</SPAN><SPAN class="string token">'data/ElecMeter.json'</SPAN><SPAN class="punctuation token">,</SPAN>
success<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN>ems<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
$<SPAN class="punctuation token">.</SPAN><SPAN class="token function">each</SPAN><SPAN class="punctuation token">(</SPAN>ems<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN>i<SPAN class="punctuation token">,</SPAN> em<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>em<SPAN class="punctuation token">.</SPAN>MeterNumber <SPAN class="operator token">==</SPAN> feature<SPAN class="punctuation token">.</SPAN>feature<SPAN class="punctuation token">.</SPAN>attributes<SPAN class="punctuation token">.</SPAN>Comment<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN>
<SPAN class="token function">emTemplateCreator</SPAN><SPAN class="punctuation token">(</SPAN>em<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token"><</SPAN><SPAN class="operator token">/</SPAN>script<SPAN class="operator token">></SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>Final, the button inside the info template
<SPAN class="keyword token">else</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">.</SPAN>layerName <SPAN class="operator token">===</SPAN> <SPAN class="string token">"ElctPole"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
feature<SPAN class="punctuation token">.</SPAN>feature<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setInfoTemplate</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">InfoTemplate</SPAN><SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">.</SPAN>layerName<SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">"<b>Park Name</b>: ${Park_Name}<br>"</SPAN> <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<b>Material</b>: ${Material}<br>"</SPAN> <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<b>Line Branch</b>: ${LnBranch}<br>"</SPAN> <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<b>Light</b>: ${Light}<br>"</SPAN> <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<b>Switch</b>: ${Switch}<br>"</SPAN> <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<b>Meter</b>: ${Meter}<br>"</SPAN> <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<b>Transformer</b>: ${Transfmer}<br>"</SPAN> <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<b>Attach Other</b>: ${OthrAttach}<br>"</SPAN> <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<b>Condition</b>: ${Condition}<br>"</SPAN><SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<b>Inspection Date</b>: ${InspctDtt}<br>"</SPAN> <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<b>Comment</b>: ${Comment}<br>"</SPAN><SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<button id='btnElectricityMeter'>ElectricityMeter</button>"</SPAN>
<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
infoPopupFeatures<SPAN class="punctuation token">.</SPAN><SPAN class="token function">push</SPAN><SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">.</SPAN>feature<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>Thanks,
Changheng