var app = (function(){ var app = {} app.init = function(){ app.bind() } app.bind = function(){ document.addEventListener('deviceready', app.ready, false) } app.ready = function(){ cookies.setItem("testing", "testing", 60*60*24*365) console.log(document.cookie) $.ajax({ url: "http://lvh.me:5000/", xhrFields: { withCredentials: true }, success: function(){ app.again() } }) document.write("duh") } app.again = function(){ $.ajax({ url: "http://lvh.me:5000/", xhrFields: { withCredentials: true }, success: function(){ } }) } app.init() })()