Sunday, March 10, 2013

Data Binding Fails on Jquery Mobile Page Navigation


Recently I started Jquery mobile application development. I got a issue where data is not binding while navigating to pages. Below is my scenario.

I had two pages.

First Page - Static Page with a ListView few Items
Second Page - Dynamic page with a ListView where data is bonded via ajax call.

On first page ListView item click it'll navigate to the second page but data is not bound to the ListView. Then I ran only the second page then the data got bound successfully.

Solution:

In the second page i added my java script files inside page div tag. Something like below.

<div data-role="page" id="secondPage">
--content
<script src="MyjsFile.js"/>
</>

Previously i had included script file links on the header tags. Below is the code that did not work.

<head>
<script src="MyjsFile.js"/>
</head>

No comments:
Write comments
Recommended Posts × +