Question: I want to retrieve a record from SharePoint list by passing field value to CAML query using javascript,I tried below code  

```
function retrieveDetails(name) {

    var ctx = new SP.ClientContext(appWebUrl);//Get the SharePoint Context      object based upon the URL
    var myList = ctx.get_web().get_lists().getByTitle("PersonalDetails");
    var query = new SP.CamlQuery();
    query.set_viewXml('<View><Query><Where><eq><FieldRef Name=\'Name\'/><Value Type=\'Text\'>' + name + '</Value><FieldRef Name=\'email\'/><Value Type=\'Text\'></Value></eq>" + "</Where></Query><RowLimit>100</RowLimit></View>');
    var items = myList.getItems(query);
    ctx.load(items);
    ctx.executeQueryAsync(onQuerySucceeded, onQueryFailed);
    function onQuerySucceeded() {
        Roomdetailstable(items);
    }
    function onQueryFailed(sender, args) {
        alert('Request failed. ' + args.get_message() +
            '\n' + args.get_stackTrace());
    }
}
function details(items) {
            var itemInfo = '';       
            var enumerator = items.getEnumerator();       
            while (enumerator.moveNext()) {
            var currentListItem = enumerator.get_current();     
            var rnmae = currentListItem.get_item('Name');
            document.getElementById("rnme").innerHTML = rnmae ;
            var emailid= currentListItem.get_item('email');
            document.getElementById("emailid").innerHTML = emailid;

        }
    }  

```

but it is showing error like below
[![enter image description here](https://i.stack.imgur.com/9ruAA.png)](https://i.stack.imgur.com/9ruAA.png)

Answer: 
resolved this issue by removing `<Query></Query>` from my caml query  

```
function retrieveDetails(name) {

    var ctx = new SP.ClientContext(appWebUrl);//Get the SharePoint Context      object based upon the URL
    var myList = ctx.get_web().get_lists().getByTitle("PersonalDetails");
    var query = new SP.CamlQuery();
    query.set_viewXml('<View><Where><eq><FieldRef Name=\'Name\'/><Value Type=\'Text\'>' + name + '</Value><FieldRef Name=\'email\'/><Value Type=\'Text\'></Value></eq>" + "</Where><RowLimit>100</RowLimit></View>');
    var items = myList.getItems(query);
    ctx.load(items);
    ctx.executeQueryAsync(onQuerySucceeded, onQueryFailed);
    function onQuerySucceeded() {
        Roomdetailstable(items);
    }
    function onQueryFailed(sender, args) {
        alert('Request failed. ' + args.get_message() +
            '\n' + args.get_stackTrace());
    }
}
function details(items) {
            var itemInfo = '';       
            var enumerator = items.getEnumerator();       
            while (enumerator.moveNext()) {
            var currentListItem = enumerator.get_current();     
            var rnmae = currentListItem.get_item('Name');
            document.getElementById("rnme").innerHTML = rnmae ;
            var emailid= currentListItem.get_item('email');
            document.getElementById("emailid").innerHTML = emailid;

        }
    }  

```
Your caml query is wrong. If you want to be sure it's not the code, please try this caml query:

```
query.set_viewXml('<View><Query><Where><IsNotNull><FieldRef Name=\'ID\' /></IsNotNull></Where></Query><RowLimit>100</RowLimit></View>');

```