Skip to content

Instantly share code, notes, and snippets.

@edoloughlin
Created November 10, 2010 12:40
Show Gist options
  • Select an option

  • Save edoloughlin/670796 to your computer and use it in GitHub Desktop.

Select an option

Save edoloughlin/670796 to your computer and use it in GitHub Desktop.
class MyAPI
objectToXml: (obj) ->
'<?xml version="1.0"?>' + (new XMLSerializer()).serializeToString objectToDOM(obj)
login: (email, password, success_callback, error_callback) ->
console.log "API login. email: [#{email}], password: [#{password}]"
xmlData = objectToXml { login: { email: email, password: password }}
# do something with xmlData
window.MyAPI = new MyAPI
@edoloughlin
Copy link
Author

MyAPI.login is called from another file:

API = window.MyAPI 
API.login email password callback1 callback2

I get the following error:

Error: ReferenceError: Can't find variable: objectToXml

(This is line 8 above)

I've also tried using this.objectToXml and MyAPI.objectToXml with the same results. What gives?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment