2014-11-17 2 views
0

저는이 함수를 호출합니다.함수가 정의되어 있지 않습니다. 코드 바 앱

$(document).ready(function() {document.addEventListener("deviceready", onDeviceReady, false);} 

function onDeviceReady() { 

    function JustCall(phonenr) 
    { 
     window.plugins.webintent.startActivity({ 
     action: window.plugins.webintent.ACTION_CALL, 
     url: phonenr 
     }, 
     function(){alert('success');}, 
     function(e){alert('error');}); 
    } 

    JustCall("tel:5582001"); 

} 

이 간단한 호출이 작동하지만, 이것을 사용하면 실용적이지 않습니다.

function onDeviceReady() { 

function JustCall(phonenr) 
{ 
    window.plugins.webintent.startActivity({ 
    action: window.plugins.webintent.ACTION_CALL, 
    url: phonenr 
    }, 
    function(){alert('success');}, 
    function(e){alert('error');}); 
} 

    $(document).on('click', '.view', function(event) { 
     console.log("DEBUG - Trying to access view"); 
     loadRecord(); 
     $(':mobile-pagecontainer').pagecontainer('change', '#view-vendor', { 
     transition: 'slidedown', 
     changeHash: true, 
     reverse: false 
     }); 
    }); 

function loadRecord() { 

    $("#CallNow").attr("onclick", 'JustCall("tel:5582001")'); 
    $("#CallNow").attr("class", "ui-btn").trigger('create'); 

} 


<a href="" id="CallNow" class="ui-btn">Call</a> 

} 

JustCall은 정의되지 않았습니다. 내가 뭘 잘못하고 있니?

답변

1

JustCall 함수는 다른 onDeviceReady의 내부 함수이기 때문에 onDeviceReady의 함수 정의 외부에서는 보이지 않습니다.

+0

신선한 눈으로 감사드립니다. –

관련 문제