How to get led state from arduino to javascript

I am trying to send a state of a led (on or off) from arduino to my android smartphone. I am using an arduino uno r3 with an eteherned shield.

I also posted my question to stackoweflow with codes. Can someone tell me what am i doing wrong?

http://stackoverflow.com/questions/28793213/how-to-get-led-state-from-arduino-to-javascript

Here is the part of my arduino code:

When you post ALL of it, maybe you'll get some help.

Meanwhile, here's part on an answer.

You need to...

More later, maybe.

Arduino code: /*Arduino Ethernet Script ServerCreated Mars 4, 2014Mikael Kindborg, Evo - Pastebin.com

Here is the index.html <!DOCTYPE html><html><!--This is an app that demonstrates how to control a - Pastebin.com

and the called arduinotcp.js // File: arduinotcp.js// Author: Mikael Kindborg// Functions for scripting t - Pastebin.com

I can't, and wouldn't if I could, do rubbish bin. There is a perfectly good mechanism for attaching code to your post. Read the stickies at the top of the Programming forum to learn how.

While you are at it, pay attention to the part that tells you that you need to describe what the code actually does, when it does not do what you expect.

The code returns a "0" whether the led is on or off. I call the function with clicking the connect button

The code returns a "0"

The code that you didn't attach to the post properly?

PaulS - You're lucky! I looked at the code. It's too long to grok at a glance and it gave me a headache - he's got a webpage using js to open a socket connection to the Arduino (not firing off http requests) and talking to it that way.
I have no idea from the nearly non-existent information he's provided where it's getting hung up - Is it connecting? What's the arduino logging to serial? If it's not connecting, what does the browser js console say? Basic debugging steps like that, which you have hopefully done, need to be shared if you want us to be able to help.

I think you'd love Espruino ( Espruino.com ), if you like writing js more than you like writing c - It would only take a few lines of code (in js!) on the microcontroller to have it answer a request like http://ip-of-espruino/run?code="digitalWrite(A1,0);for(var i=0;i<10;i++){eeprom.write(i,eeprom.read(i+10,1)-i*2);}analogRead(A0);" by doing just what you'd expect - write A1 low, modify those bytes on the eeprom and echo the analog reading on A0 back to you, just by passing the string to eval() and returning the result in the http response... It's pretty cool :wink: