2012-04-12 49 views
0

的PhoneGap或科尔多瓦通知,骨干不工作,要求和JavaScript。PhoneGap的通知不工作

所以情况是,如果用户名和密码是空的,应该(使用PhoneGap的)通知,但它不会工作。有任何想法吗?

我有这样的代码

define([ 
'jquery', 
'backbone', 
'underscore', 
'base64', 
'mobile', 
'cordova', 
'const', 
'text!template/login/login.tpl.html' 
],function($, Backbone, _, base64, Mobile, Cordova, Const, template){ 

if(!Const.USERNAME || !Const.PASSWORD) 
     { 
      navigator.notification.alert("Invalid Username/Password!"); 
      $("input").val(""); 
     }else{ 

      var auth = EncodeAuth(Const.USERNAME,Const.PASSWORD); 

      var sendAuthorization = function (xhr) { 
       xhr.setRequestHeader('Authorization', auth) 
      }; 

      this.model.save(this.model, { 
       beforeSend : sendAuthorization, 
       success: function(model,result){ 
        if(result.ErrorMessage === null) 
        { 
         alert(JSON.stringify(result.Message)); 
         $("input").val(""); 
        } 
        else 
        { 
         alert(JSON.stringify(result.ErrorMessage)); 
         $("input").val(""); 
        } 
       }, 

回答

0

解决我的问题。我用科尔多瓦或PhoneGap的版本错误。我使用的Android版本,因为我也检查它的窗口。