2012-04-12 48 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版本,因爲我也檢查它的窗口。