javascript - sharepoint field value show undefined -


i learning sharepoint 2013. trying show data in web part. below code

<script unselectable="on"> window.onload = function() {   myfunction(); }; function myfunction() { console.log("test"); $().spservices ({ operation: "getlistitems", async: false,  weburl: $().spservices.spgetcurrentsite(), listname: "share point list", camlquery: "<query><orderby><fieldref name='id' ascending='true' /></orderby></query>",  completefunc: function (xdata, status) { $(xdata.responsexml).spfilternode("z:row").each(function()  { console.log(firstname); var firstname = $(this).attr("ows_first_name"); var lastname = $(this).attr("ows_last_name"); var gender = $(this).attr("ows_gender"); var dateofbirth = $(this).attr("ows_date_of_birth"); var email = $(this).attr("ows_email"); var city = $(this).attr("ows_city"); var country = $(this).attr("ows_country"); console.log(gender); $("#mydatatable").append("<tr align='right'>" + "<td>"+firstname+"</td>" + "<td>"+lastname+"</td>" + "<td>"+gender+"</td>" + "<td>"+dateofbirth+"</td>" + "<td>"+email+"</td>" + "<td>"+city+"</td>" + "<td>"+country+"</td>" +  "</tr>");  }); } }); } </script> 

for fields name single name email, gender, city correct value field names space first name, last name etc undefined value. should correct syntax this?

brother ...

use rest functionality, use ajax read whole item of list , compare using .indexof <0 check if there name.

first use ajax rest link read items. crei list of names, 1 traversing whole list , inside append in div camparando names.indexof if (names [i]) <0 && names.indexof (names [i])


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -