Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By Mmiscool
#35768 If you look t the msg branch code and example over at esp8266basic.com
you can use this as a mechanism for javascript to dynamical push and pull information from the esp to the browser.


THis javascript function allows for a url to be retrieved and laced in to a variable. Java script can do any thing it wants with that variable.
Also depending on how you format the url you can send information to the esp.
http://www.esp8266basic.com/msg-url-usage.html
http://www.esp8266basic.com/msg-url-advanced.html

Code: Select allfunction httpGet(theUrl)
{
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
    xmlHttp.send( null );
    return xmlHttp.responseText;
}
User avatar
By Mmiscool
#35777 The serialprint and input commands allow for sending data out on the serial and pulling information from serial.

These are under base commands in the documentation. Take a look and have the esp hooked up to a serial terminal on the PC so you can experiment with the commands.

The input command requires a cr+lf for the data to be placed in to the variable and is blocking.