Agon Bina
Posts: 0
Joined: Thu Oct 04, 2012 5:01 am

javascript code to open a popup?

I looked into the javascript api but couldn't understand it correctly.

If I want to open a popup using javascript, how do I do it?

let's say the popup name in the app builder is addPlayer.
I tried using Tiggr('addPlayer').open();
but it won't work.

thanks!

Agon Bina
Posts: 0
Joined: Thu Oct 04, 2012 5:01 am

javascript code to open a popup?

I would also like to know how to invoke a service using javascript? :)
I.e. after a line has been executed on a custom javascript code, I would like to invoke a service.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

javascript code to open a popup?

To open a popup, you need to use jQuery Mobile API.

code
$.mobile.changePage("pop.html", {transition: "pop"});
/code

where the popup name is 'pop'.

If you check the option to render all pages into one file (Project Project Profile General), then you can use this:

code
$.mobile.changePage($('div[dsid="pop"]'), {transition: "pop"});
/code

All the API you need is here: http://jquerymobile.com/demos/1.2.0/d...

You can also use Open as Popup action in the builder.

Agon Bina
Posts: 0
Joined: Thu Oct 04, 2012 5:01 am

javascript code to open a popup?

hmmm this works on the browser but it's not working on the tiggzi app tester. I was doing the navigateTo('addPlayer', 'ajax'); till you told me about this and same thing was happening. The popup loaded on the browser, ie when im testing it on the phone browser OR the pc browser. But when I load it up on the app tester, it doesn't work.

Agon Bina
Posts: 0
Joined: Thu Oct 04, 2012 5:01 am

javascript code to open a popup?

I am talking about the pop up by the way.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

javascript code to open a popup?

Try with Open as Popup action, it works when I'm testing it.

Agon Bina
Posts: 0
Joined: Thu Oct 04, 2012 5:01 am

javascript code to open a popup?

Yeah that works , but I am checking if two variables are equal then opening the popup. If those two variables are not equal then there is no need for the popup. Do you know what I mean? I could probably think of another solution(ie just use another screen instead of the popup) but the popup would be a better solution.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

javascript code to open a popup?

Try this:

code
Tiggzi.navigateTo('pop', {transition: 'pop'});
/code

Agon Bina
Posts: 0
Joined: Thu Oct 04, 2012 5:01 am

javascript code to open a popup?

It's working now ... the problem was something else though, all of the above commands should work too, it's just that there was a problem with the local variable which was being saved on the local storage on my phone ... that was causing a problem when i was checking whether to open the popup or not.

Thanks Max! You are awesome :)

Return to “Issues”