Javascript passing a variable to PHP -
this question has answer here:
- how pass variables , data php javascript? 17 answers
what i'm trying use below javascript
pull php
page html
. works, need , struggling use javascript
send variable php
can use mysql
send results back.
httprequest("garage-view-default.php", showdefaultimage); function showdefaultimage(widget){ d = document.getelementbyid('garage-view-default'); d.innerhtml = widget; } function httprequest(url, callback) { var httpobj = false; if (typeof xmlhttprequest != 'undefined') { httpobj = new xmlhttprequest(); } else if (window.activexobject) { try{ httpobj = new activexobject('msxml2.xmlhttp'); } catch(e) {try{ httpobj = new activexobject('imicrosoft.xmlhttp'); } catch(e) {} } } if (!httpobj) return; httpobj.onreadystatechange = function() { if (httpobj.readystate == 4) { // when request complete callback(httpobj.responsetext); } }; httpobj.open('get', url, true); httpobj.send(null); }
you can add value url:
garage-view-default.php?key=value
Comments
Post a Comment