Google Script Web App AJAX, jQuery, JSON?

I am trying to follow “Example 3: Web Response” on “https://learn.sparkfun.com/tutorials/electric-imp-breakout-hookup-guide/all#example-3-web-response

I implemented the code on script.google.com but was unable to see the pin readings. Can someone please help me out! Here is the code

http://jsfiddle.net/8GdLw/44/

this code works on jfiddle and also if you copy paste it in a text file and save it as an html file. Here is the access to the
google script project

https://script.google.com/d/1KNUnQR-Ev2lRQNo7vAzUQjcgcUnVJnfyeFJY-HmT_YUnBhMWB_NWgSHP/edit?usp=sharing

just to clarify.

your project works just fine in jfiddle.

your project works just fine if you open a local html file.

and the problem is that your google script project doesn’t work?

I don’t know anything about google script - sorry! - but if you are only using that as a means to an end…

I recommend you have a look at the snackbot example. In this project the agent serves up the web page. It will work without employing google script or jfiddle and does not require you to have web hosting. One requirement is that you change " to “” inside the literal string (your web page code)

snackbot on github

the key bit that will serve up your web page it this

http.onrequest(function(request,res){ if (request.body == "") { res.send(200, html);.....

You would copy paste the url of the agent into your browser address bar.

unless… have I misunderstood something?

Thanks for your reply. You have perfectly understood all parts of my question. Sorry, I wasn’t very clear about it. I am going to try what you have suggested. Moreover, do you know of any good tutorial where I can use http request to get potentiometer reading from electric imp? The code on the electric imp website doesn’t show one the code for the agent.

https://electricimp.com/docs/examples/analogin-pot/