I am new to phonegap and working on a phonegap iOS app.I am trying to call a JavaScript function from HTML class, but strangely it is not getting called. The same works fine with android codebase.
Here is my HTML class code:
<script language="javascript" type="text/javascript"></script>
<!--<script type="text/javascript" charset="utf-8" src="js/cordova.js"></script>-->
<script type="text/javascript" charset="utf-8" src="pages/VoiceRecord.js"></script>
<div data-role="page" id="VoiceRecord">
<div data-role="header" data-position="fixed" class="header">
<a onclick='OpenLeftPanel();' data-theme="a" ><img class="iconimg" src="images/lines_menu.png" data-theme="none"/></a>
<img class="headlogo" src="images/logo_inner.png"/>
<a onclick='OpenRightPanel();' data-theme="none" ><img class="iconimg" src="images/profile_menu.png"/></a>
</div>
<div data-role="main" class="ui-content" id="VoiceRecordnotes">
<label id="labe_id">Recording Audio... </label><label id="audio_position"> </label>
<button id="media" data-inline="true" class="ui-btn-a ui-mini" type="button" value="" onclick="recordAudio()">Record</button>
<button id="stop" data-inline="true" class="ui-btn-a ui-mini" type="button" value="" onclick="stop()" disabled>Stop Recording</button>
</div>
</div>
<script>
function recordAudio(){
alert("indside recordAudio in .htm");
document.getElementById("labe_id").style.visibility="visible";
document.getElementById("audio_position").style.visibility="visible";
startAudioRecording();
$('#media').attr('disabled', 'disabled');
$("#stop").removeAttr('disabled');
}
function stop(){
alert("inside stop in .htm");
$('#stop').attr('disabled', 'disabled');
$("#media").removeAttr('disabled');
stopAudioRecording();
navigate('helpline');
}
</script>
and my JS class code is:
function startAudioRecording(){
alert ("recordAudio in js");
var user = getCurrentUser();
alert("user" +user);
var username=user.userId;
var phoneno=user.phone_no;
cordova.exec(succesCallBack, erorCallBack,'AudioRecording','recordAudio',[{"username":username,"phoneno":phone_no}]){
};
I have included my JS file in index.html. When I run my HTML file in browser and try to jump to my JS file it opens a blank file in safari.
Can anyone guide me with this?