Here is an example using CSOM in JavaScript.
var context = new SP.ClientContext.get_current();
var listTitle = "Name of List";
var viewTitle = "Name of View"; //You can compose a CAML or use a view.
list = context.get_web().get_lists().getByTitle(listTitle);
view = list.get_views().getByTitle(viewTitle);
context.load(view);
context.executeQueryAsync(
function(sender, args) {getLinkListItem("<View><Query>" + view.get_viewQuery() + "</Query></View>")},
function(sender, args) {alert("error: " + args.get_message());});}
}, 'sp.js')});
function getLinkListItem(camlQuery){
var context = SP.ClientContext.get_current();
var approvalList = context.get_web().get_lists().getByTitle(listTitle);
var query = new SP.CamlQuery();
query.set_viewXml(camlQuery);
listItems = approvalList.getItems(query);
context.load(listItems);
context.executeQueryAsync(ReadListItemSucceeded, ReadListItemFailed);
}
//Execute this when you receive the data back from SharePoint.
function ReadListItemSucceeded(sender, args) {
var enumerator = listItems.getEnumerator();
while (enumerator.moveNext()) {
var listItem = enumerator.get_current();
alert('The ID for ' +listItem.Title + ' is ' + listItem.id);
}
}
//Execute this function if things go wrong.
function ReadListItemFailed(sender, args) {
alert('Request failed.');
}
You should also take a look at the MSDN library entry for the JavaScript/ECMA CSOM.
Here is an example using a CAML query rather than a SharePoint view.