Q:

How to get list name through javascript?

I wrote javascript for getting list items but here I'm hard coded list name as "Projects"(my list name). How can I get list name automatically with out hard coding,
function DoLogicalDelete()
{

    var clientContext = null;
    var oList = null;
    var oListItem = null;
   //var lstItmIsDeleted = null;

    var itmID = getQuerystring('ID');

    clientContext = SP.ClientContext.get_current();

    oList = clientContext.get_web().get_lists().getByTitle('Projects');

    //var oListItemID = SP.ListOperation.Selection.getSelectedItems(clientContext);

    oListItem = oList.getItemById(itmID);                         // getting ID

    clientContext.load(oListItem,"Title", "IsDeleted");            // load items to oListItem

    oListItem.set_item('IsDeleted', true);
    oListItem.update();

    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded),Function.createDelegate(this, this.onQueryFailed)); 
}

Appreciate if anyone help.
Thank you.

A:

You could change
oList = clientContext.get_web().get_lists().getByTitle('Projects'); 

to
oList = clientContext.get_web().get_lists().getById(_spPageContextInfo.pageListId)

