firefox - AJAX XMLHTTP Request -
i have created mozilla extension button located on browser. button has javascript when clicked should send xmlhttlp request. want use local html file have created in url field of it. when use still can't view html page. why so? code goes this:
custombutton = { 1: function () { var xmlhttp; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("mydiv").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","http://localhost/sample.html",true); xmlhttp.send(); } }
the sample.html
file located in htdocs
folder of xampp.
accessing local files xmlhttprequest not allowed security reasons.
Comments
Post a Comment