Tuesday, 15 July 2014

jquery - $.ajax function not called after clicking link -



jquery - $.ajax function not called after clicking <a> link -

i'm using jquery mobile , i'm in dealing problem:

i have 2 html pages: index.html , page.html

//index.html ... <script src="script.js"></script> <body> <div id='contents'></div> </body> ... //script.js $(document).ready(function(){ $.ajax({ ... success: $("#contents").html(content_to_display).trigger('create'); ... }); });

and page calls previous

//page.html ... <body> <a href="index.html" data-icon="arrow-l" data-role="button">back</a> </body> ...

the problem when click on button (after refreshing page.html), page index.html displayed correctly, except stays empty unless manually refresh page (f5 or ctrl+r) displaying content want displayed.

how load index.html page without manually refreshing page every time?

refresh problem, timeline of have happened:

index.html loaded page changed page.html , body content loaded index.html dom link still domain/page.html because of total page refresh, page.html reloaded without head content of index.html. page changed index.html , body content loaded page.html dom without head part , reason why javascript not triggered

this problem fixed if both index.html , page.html have identical head content, reference same custom js file. more solution problem (with solution) take @ article, more transparent personal blog. or can found here.

ajax jquery jquery-mobile

No comments:

Post a Comment