Reputation: 14204
I am working on a JQuery Mobile app. I want to distribute this app via the AppStore with the help of Cordova (PhoneGap). I want to have a button such that when a user clicks it, their contacts appear. When they choose one, I want to get the email address associated with it if possible. Currently, I have the following:
<input id="viewButton" type="button" value="+" onclick="getContact();" />
<script type="text/javascript">
function getContact() {
var options = new ContactFindOptions();
var fields = ["name", "emails"];
navigator.contacts.find(fields, onSuccess, onError, options);
}
function onContactSuccess() {
alert("Great");
}
function onContactError() {
alert("oops");
}
</script>
Much to my surprise, I do not see a contact popup. What am I doing wrong?
Upvotes: 0
Views: 2011
Reputation: 1692
You forgot to change the onSuccess and onError method names. The instance constructor of contacts.find should read:
navigator.contacts.find(fields, onContactSuccess, onContactError, options);
Upvotes: 2