-->
Page 1 of 1

HTML Get Response

PostPosted: Fri Aug 14, 2015 4:24 am
by Merki
Hi There, I am new to the ESP8266 and I am trying to set up a html Website that connects to the ESPs IP Adress and has some Parameter values to set a LED for example. This already works quite well, I used this example
http://allaboutee.com/2015/01/02/esp8266-arduino-led-control-from-webpage/
There is a JQuery which Looks like this:
$.get("http://192.168.4.1:80/", {pin:p});

My idea is to use the same JQuery to get a Response, according to the method it should not be a Problem:
http://www.w3schools.com/jquery/ajax_get.asp

THis is the used function:
Code: Select all$.get(URL,data,function(data,status,xhr),dataType)

The data which has been responded is stored in "data".
So I tried it like this:

Code: Select all$.get("http://192.168.4.1:80/", {pin:p},function(data){
                           alert(data)
};

Unfortunatly it does not work, it recieves nothing. But I am sending before CIPCLOSE the data I want as a Response, in this case just "LED is ON", and this in an alert box.
Has anyone some idea how to get this Response, or how to use this function??

THe other way is to program the HTML webside in the arsduino and send it to the ESP and using it as a webserver.
Like this code:
http://arduino-hannover.de/2014/12/11/wifi-kochbuch-mit-esp8266/

But this is way to complex and is not flexible for the HTML Website.. THe better solution is to have a separate HTML Website.
Are there any ideas?