javascript - Onclick event only works on double click -
my onclick
event works on double click. searched previous similar questions none of them worked. please if can me this.
function getdetails(tablename,field) { gotofind("0"+tablename); var prntid=sessionstorage.getitem('prnt_id'); $.ajax({ url: 'addresses/getaddressdetails', type: "post", data: {'tablename':tablename,'fld':field,'prntid':prntid}, success: function(data){ var obj = json.parse(data); res=res.split("|"); var str="<center><input type='button' value='exit' onclick=javascript:window.close();opener.window.focus();></center><br/><table border=1>"; str+="<tr>"; for(var i=0;i<res.length;i++) { str+="<th>"+res[i]+"</th>"; } str+="</tr>"; for(j=0;j<obj.length;j++) { str+="<tr>"; for(i=0;i<res.length;i++) { str+="<td>"+obj[j][res[i]]+"</td>"; } str+="</tr>"; } str+="</table>"; z = window.open('', 'popup','height=' + screen.height + ',width=' + screen.width + ',resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=yes'); z.focus(); z.document.open(); z.document.write(str); } }); }
here calling method index page
<button class="w3-btn w3-brown" value='skip' onclick="getdetails('addresses','party_id')">current party address</button>
Comments
Post a Comment