因为Javascript没有加载到jquery mobile中的dom中

我有一个page1.html,其中有一个链接,如下所示:

PAGE2 

部分https://stackoverflow.com/questions/21625225/as-in-javascript-is-not-loaded-into-dom-in-jquery-mobile/page2.html是这样的:

     

还有这个:

     

这两个js文件在https://stackoverflow.com/questions/21625225/as-in-javascript-is-not-loaded-into-dom-in-jquery-mobile/page2.html上实现了一些function,但是当通过page1.html导航到https://stackoverflow.com/questions/21625225/as-in-javascript-is-not-loaded-into-dom-in-jquery-mobile/page2.html ,这两个文件不起作用,但是当使用data-ajax="false"它可以工作。 怎么了。 scripts应该放在哪里? 我需要默认的ajax来实现更平滑的过渡。

更新

根据您更新的问题,您不能单页模型多页模型混合使用。 当你加载page2.html第一个data-role="page ,只有第一个加载。其他任何东西都被忽略了。

例:

index.html(第一页加载) – 无论是启用还是禁用Ajax, 中的所有标记都会加载到DOM中。

         

page2.html – 当启用 Ajax时,除了FIRST data-role="page"及其内容之外,所有标记都被忽略。

       

使用单页模型和Ajax时,必须将外部页面的JS库/代码放在

 

jQuery Mobile通过Ajax加载外部页面,它只在加载

并忽略侧 div中的任何其他标记。