0

I am making a jQueryMobile and PhoneGap app. I need to call ajax in page init. Unfortunately it never fires:

$("#kontakty").bind('pageinit', function() {

is in the file with:

<div data-role="page" id="kontakty">

When navigating from page A.html to kontakty.html, my event is not fired. I tried replacing bind with live, but no success. I also tried pageshow, pageinit, pagechange... and all methods form jQM docs.

The weird thing is that, when I change "#kontakty" with document, it works. But I cannot make it permament, because it calls with every other .html file I do open (it is not good).

Thanks in advance.

Piotr Krysiak
  • 2,815
  • 3
  • 23
  • 35

1 Answers1

3

Having a look here it could be that your JavaScript is not inside the <div data-role=..

I would also change your .bind to a .live as they have in the docs.

Community
  • 1
  • 1
Manatok
  • 5,506
  • 3
  • 23
  • 32