On Monday, July 29, 2013 12:01:01 AM UTC+2, jose llopis wrote:
> thats my problem. i use this code and only get null
>
>
> var allContacts = navigator.mozContacts.getAll({});
> allContacts.onsuccess = function(event) {
> var cursor = event.target;
> if (cursor.result) {
> if(cursor.result['tel']!=null)
> {
> $("#res").append((cursor.result['givenName']+" "
> +cursor.result['familyName']+"<br/>"));
> for(i=0;i<cursor.result['tel'].length;i++)
> {
> $("#res").append("telf:
> "+(cursor.result['tel'][i].value)+"<br/>");
> }
> alert(cursor.result['email']);
> }
> cursor.continue();
> } else {
> alert("No more contacts");
> }
> }
This works fine for me:
var allContacts = navigator.mozContacts.getAll({});
allContacts.onsuccess = function(event) {
var cursor = event.target;
if (cursor.result) {
console.log(cursor.result.tel[0].value);
cursor.continue();
}
}
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g