javascript - modifying html content on android phonegap application -
I have the following code that brings all the contacts from the device, and displays them in a table. } Note: This function is called when a button is clicked when the page is fully loaded Cordova: Cordova -3.1.0 PhoneGrap: PhoneGap -2.2.0 This works perfectly well on virtual emulators, but when Tested on a real device (two devices tested on Android) it brings contact but the html content of 'tableys' has not been modified. Sector try but still does not work, and no error appears in the console and also in You do this Perhaps some fields are not on the real device, think about the Javascript is likely throwing an undefined error. Divide that line into sections. Function Backout allContacts () {var htmltd; Var filter = ["displayName", "phone number", "email"]; // field navigator.cont.find (filter, function (contact) {// contactList = JSON.stringify (contact); alerts ('found' + contacts.length + 'contact'); (var i = 0; I & lt; Contact.length; i ++) {html5 + = '& lt; tr & gt; & lt; td & gt;' + contact [i] .displayName + '& lt; / td & gt; Lt; td & gt; '+ contact [i] .phoneNumbers [0] .value +' & lt; / td & gt; & lt; td & gt; '+ contact [i] .mail [0] .value + & Lt; / td & gt; & lt; / tr & gt; ';} if (htmltd ==' ') {Warning (' array populated empty '); and {document.getElementById ("tablebody"). InnerHTML = htmltd;}}, on error, {"multiple": true}); Function on error (contact error) {warning ("error =" + contactError.code); }
$ ( '# tablebody'). Html (htmltd)
logcat .
for :
html5 + '' & lt; Tr & gt; & Lt; Td> Inside there is a very long convergence; + Contact [i] .displayName + '& lt; / Td> & Lt; Td> + Contact [i] .phoneNumbers [0] .value + '& lt; / Td> & Lt; Td> + Contact [i] .mail [0] .value + '& lt; / Td> & Lt; / Tr & gt; ;
email or
phone number . You firmly believe them that there is a zero-indexed value.
Comments
Post a Comment