javascript - Magento adminhtml: "sendMail" is not a function -
i'm developing custom admin page magento (i know i'm bit out of usual way develop magento's extensions). have function called sendmail
that, when button clicked, calls controller
sends mail. fine first time run (so know it's not routing problem, javascript one), second 1 error uncaught typeerror: sendmail not function
.
here code:
button piece (this added page through javascript)
"<td><button onclick='sendmail("+"\"<?php echo mage::helper('adminhtml')->geturl('adminhtml/sendbrochure/send/'); ?>"+"?isajax=true"+"&id="+resultlog[i].id+"\")'>send brochure</button></td>";
sendmail function:
function sendmail(link){ sendmailpath = link; sendmail = new xmlhttprequest(); sendmail.open("get", sendmailpath, true); sendmail.setrequestheader("content-type","application/x-www-form-urlencoded"); sendmail.send(); }
do have clue why code works first time?
as comment fixed problem, going post answer:
just guess, but: when try change "sendmail" variable different inside sendmail function?
actually thought use local variables names as like, since local names should available inside function , removed stack when block left. maybe can explain?
Comments
Post a Comment