monacaを利用して、webアプリケーションで制作したものをアプリに落とし込んでおります。
webアプリケーションではprototype.jsを利用して、定期的に情報更新がないかを確認&更新があれば更新数を表示するプログラムを組んでおりましたが、monacaにうまく適用できずにいます。。
以下がコードになります。
サーバー側処理は更新の数(値)を返しております。
jQuery (Monaca version)及びprototype.jsを、js/cssコンポーネントに追加しております。
jQuery.noConflict()の使い方が悪いのでしょうか。
ご教示頂ければ幸いです。
(head)
<script src="components/loader.js"></script> <link rel="stylesheet" href="components/loader.css"> <script> ons.bootstrap(); jQuery.noConflict(); var j$ = jQuery; (function(){ 'use strict'; j$(document).on('pageinit', '#top-page', function() { j$('#message_board', this).on('click', function() { app.navi.pushPage('message.html'); }); watch_new(); }); })(); function watch_new(){ var id = "1"; var myajax = new Ajax.PeriodicalUpdater('new', 'url', {postBody: 'id=' + id, frequency: 10000}); } </script>
(html)
<ons-template id="top.html"> <ons-page id="top-page"> <ons-list-item modifier="chevron" class="item" id="message_board"> <ons-row> <ons-col class="title"> <header> <span class="item-title">掲示板</span> <div id="new"></div> </header> </ons-col> </ons-row> </ons-list-item> ・・・ </ons-page> </ons-template> <ons-template id="message.html"> <ons-page id="message-page"> <ol id="message"></ol> </ons-page> </ons-template>

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。