首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PhoneGap-Plugin-Push或jQuery/Ajax

PhoneGap-Plugin-Push或jQuery/Ajax
EN

Stack Overflow用户
提问于 2016-02-01 04:48:40
回答 1查看 159关注 0票数 1

我正在尝试对保存客户端注册id的php文件进行ajax调用。为此,我使用以下javascript代码:

代码语言:javascript
复制
var app = {
// Application Constructor
initialize: function() {
    this.bindEvents();
},

// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
    document.addEventListener('deviceready', this.onDeviceReady, false);
},

// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicitly call 'app.receivedEvent(...);'
onDeviceReady: function() {
    var push = PushNotification.init({
        android: { senderID: "103232657886" },
        ios: { alert: "true", badge: "true", sound: "true" },
        windows: {}
    });

    push.on('registration', function(data) {
        $("#gcm_id").text(data.registrationId);

        $.ajax({
            url: "http://sebtm.lima-city.de/AT-GCM/insertRegistrationId.php",
            type: "POST",
            dataType: 'text',
            data: {registrationId: data.registrationId},
            success: function (data) {
                alert(data);
            }
        });
    });

    push.on('notification', function(data) {
    });

    push.on('error', function(e) {
    });
}

};

其中MySenderId & MyUrl是占位符。注册ID显示在#gcm_id中,但ajax-call不起作用。如何调试这个?如何解决这个问题?

EN

回答 1

Stack Overflow用户

发布于 2016-02-01 05:24:32

解决了- Ajax调用运行良好-php文件中有一个错误。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35119286

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档