Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By Mmiscool
#32979 Hello.

The javascript command will add a
Code: Select all<script src="myscripts.js"></script>


into the html buffer.

If you have upload a ".js" file in the file manager you can include it in to your page by using the java script command.

Will work on putting a demo together with some practical application.
User avatar
By matherp
#33157 Mike

I've written a trivial javascript file and shown that it runs by using "document.write" inside the script.

The big question of course is whether there is any mechanism of getting data from the Basic program into the javascript and whether any Basic variable can be manipulated by the javascript so that its changed value is available to Basic?

Thanks

Peter
User avatar
By Mmiscool
#33192 The msg url and the msgbranch command could be used for this.

I have n example here.
http://www.esp8266basic.com/msg-url-usage.html


Used in conjunction with the following java script you can do some cool things.

Code: Select allfunction httpGet(theUrl)
{
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
    xmlHttp.send( null );
    return xmlHttp.responseText;
}


The above javascript code could be used to push and pull data from the esp with the above example.