I want to get URLs from SharePoint Links list using client object model javascript, can someone help me, I tried the following script but when I am alerting its result it shows me the URL value as [object Object] but not the actual URL.
<script type="text/javascript">
var siteUrl = '/';
function retrieveListItems() {
alert("hello");
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('Links');
var camlQuery = new SP.CamlQuery.createAllItemsQuery();
//camlQuery.set_viewXml('<View><Query></Query></View>');
this.collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded(sender, args) {
var listItemInfo = '';
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
listItemInfo += '\nID: ' + oListItem.get_id() +
'\nURL: ' + oListItem.get_item('URL');
//'\nFieldName: ' + oListItem.get_item('Notes');
}
alert(listItemInfo.toString());
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}</script><input id="button1" onclick="retrieveListItems()" type="button" value="GetItems"/>