I use jQuery mobile popup for these mobile sites and also works great for desktop browsers. I hope you use a callback like this (well, I use something like this)
var jsonp = document.createElement("script"); jsonp.type = "text/javascript"; jsonp.src = "http://foo.com/api/ad?foo_var=4345&callback=displayinfo"; document.getElementsByTagName("body")[0].appendChild(jsonp);
In the callback function, you can use these popups, for example
function displayinfo(data) { $("#somepopup").html('<div data-role="popup"> '+data+' <div id="ok" data-inline=true data-role=button> <a class="ui-link-inherit" href="">Ok</a> </div> <div id="cancel" data-inline=true data-role=button> <a class="ui-link-inherit" href="">Cancel</a> </div> </div>'); $('#ok').button(); $('#cancel').button(); $("#somepopup").popup(); }
you should have a div with id somepopup in your document, and all this works fine if you implement jquery mobile. Hope this helps.
source share