小编use*_*214的帖子

Cordova JQuery AJAX 不工作

经过谷歌搜索几个小时后,我必须写下 cordova(CLI 5.3.3) 应用程序在通过 jquery AJAX 调用时返回未找到的页面。

我已经按照白名单插件( https://github.com/apache/cordova-plugin-whitelist )中的所有步骤进行操作,但仍然没有运气。

我已经将这些行包含在 config.xml 中

<access origin="*" />
<allow-navigation href="*" />
Run Code Online (Sandbox Code Playgroud)

还包括 CSP 等

<meta http-equiv="Content-Security-Policy" content="default-src 'self' https:">
Run Code Online (Sandbox Code Playgroud)

AJAX请求就像

$.ajax({
                    beforeSend: function() { $.mobile.loading("show"); }, //Show spinner
                    complete: function() { $.mobile.loading("hide"); }, //Hide spinner
                    url: weburl+"lgoin.php",                        
                    data: { email: $("#txtemail").val(), password: $("#txtpassword").val()},
                    type: "POST",                       
                    success: function(data) {                       
                        var response=$.parseJSON(data);                         
                        }                           
                    },                      
                    error: function (jqXHR, exception) {
                        var msg = '';
                        if (jqXHR.status === 0) {
                            msg = 'Not connect.\n Verify Network.'; …
Run Code Online (Sandbox Code Playgroud)

ajax jquery jquery-mobile cordova

3
推荐指数
1
解决办法
9607
查看次数

JQuery 倒计时不适用于数据表页面更改事件

我正在开发基于优惠券的网站,我需要在数据表中使用倒计时脚本(http://hilios.github.io/jQuery.countdown/)。

我遇到页面更改事件停止第一页的计时器,并且计数在其他页面上不起作用。

这是我每次加载页面时更新计数器的代码

$('#sample_2').on( 'page.dt', function () {
    alert("page changed");
    $('[data-countdown]').each(function() {
        var $this = $(this), finalDate = $(this).data('countdown');
        $this.countdown(finalDate, function(event) {
            $this.html(event.strftime('%D days %H:%M:%S'));
        });
    }).on('finish.countdown', function(event) {
        $(this).addClass("label label-sm label-danger");
        $(this).html('This offer has expired!');
    });
} );
Run Code Online (Sandbox Code Playgroud)

HTML代码

<tr>
    <td>f2 coupon</td>
    <td>
         <div data-countdown="2015-05-18 12:09:00" class="label label-sm label-success">20 days 15:04:54</div>
    </td>
    <td class="numeric">1</td>
    <td class="numeric">1</td>      
</tr>
Run Code Online (Sandbox Code Playgroud)

如果需要,请随时询问更多信息

请指教。

-尼克斯

jquery datatables jquery-countdown

1
推荐指数
1
解决办法
1409
查看次数