Domanda

Thanks for this article Enable like function from catalog page via javascript object model - improve this? is very useful and its working on my page, but i need your help, i am calling rest api function to read the first 3 items of the list and i am trying to integrate the like functions code in my main code and to do that i have insert this: < div id='idnumb' >"+itemid+"< / div > in the ajax code to read id's value of each item and i am trying to set the id value to the variable as var sItem = $("div#idnumb").text(); but i have a main problem that i need to set the sItem value after the load of the list contents ( title, id , description content) ??? i tried many workaround steps but still cannot read the id of each item.

First question, this is a good solution to convert the like function code to read dynamic item value, by using $("div#idnumb").text()

and if not, please suggestion another solutions

È stato utile?

Soluzione

After lots of research, I use window.bind instead of document.ready to run script after the page loads.

Sample code as below:

$(window).bind("load", function() {
 // Your codes here     
});
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top