[英]Error On button click event in Android Phonegap application
I have a button in my phonegap HTML page to which i have added a button click event and ajax call to webservice URL.At present i am not calling any webservice URL but the main issue that i have is that my button click event is not getting fired .on logcat it is giving following error..我的phonegap HTML页面中有一个按钮,我添加了一个按钮单击事件和对webservice URL的ajax调用。目前我没有调用任何webservice URL,但我遇到的主要问题是我的按钮单击事件没有得到解雇 .on logcat 它给出了以下错误..
stale touch event action_down received from webcore ignoring
Here is my button HTML code..这是我的按钮 HTML 代码..
<div style="display: table; margin: 0 auto; background-color: green;">
<button id="call" class="button">Call</button>
</div>
and here is my js file code for button click event ..这是我的按钮点击事件的js文件代码..
//Add event listener to run when the device is ready
document.addEventListener("deviceready", onDeviceReady, false);
//Device is ready
function onDeviceReady() {
$(document).ready(function(){
$('#call').bind('click',function(evt){
senddata();
});
});
}
function senddata(){
e.preventDefault();
var empname=$("#name").text();
alert(empname);
var contactno=$("#contact").text();
alert(contactno);
//Webservice URL
var URL="index.html";
$.ajax({
url: URL,
data: "",
type: 'POST',
success: function (resp) {
alert(resp);
},
error: function(e) {
alert('Error: '+e);
}
});
}
Please help me to resolve this issue..Thanks..请帮我解决这个问题..谢谢..
Instead of bind()
just use the following:而不是bind()
只需使用以下内容:
$(document).on('click', '#Login_button', function() {
//Call your method to call webservice.
senddata();
}
or other way to add click event to button is following:或其他向按钮添加点击事件的方法如下:
<button id="call" onclick="senddata();">Call</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.