First, about me: My language is objective-c, c++. I have built websites in the past, but have never created any true web applications or have ever gone into the trenches with javascript.
What I am trying to do: is create a web server for the purpose of testing iPhone applications. The server will:
Host a page
In which visitors can login with facebook
Upon facebook OAuth
Server will query facebook for visitor metadata (email and full name)
And store metadata (in some format, I don’t know)
The server will also host an API (my iOS-app can talk to)
Which accepts iOS-app queries
And return stored metadata via JSON.
So my question is: How does this all work within an html document?
e.g. I can only query facebook after I know the visitor has logged in, to facebook. How do I (dynamically) let the html document know, “hey the visitor has verified with facebook OAuth, now call this inline javascript function”?
Any information you can point me to that tells me how javascript functions are called/interacts in an dynamic web environment would be greatly appreciated.
Thanks SO
Look into G-WAN. It’s a powerful web application server which uses C, C++ and Objective-C scripts natively. It’s probably the best web server out there, and you’ll be on familiar ground.
As far as your question goes, you’ll call these in your
scripttags. They can be anywhere, but with JavaScript, if it’s in the head, you’re going to want to wait until the DOM is fully loaded, otherwise you won’t have access to nodes which haven’t yet been rendered. That means if you’re trying to access a DIV that hasn’t been rendered, you’ll get an error.