In CAML Query, there is no possible criteria as LIKE, so you can use Contains or BeginsWith
Look at this threads/article:
SharePoint list CAML query using CONTAINS
Using CAML "BeginsWith" in SharePoint
Also you need to check your StudName field as a null or not before going for CAML query. So consider below conversion for your CAML query:
function retrieveListItems() { if(StudName != null){ // StudName is the variable of your column StudName var clientContext = new SP.ClientContext(siteUrl); var oList = clientContext.get_web().get_lists().getByTitle('Your List Name here'); var camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml("<View>" + "<Query>" + "<Where>"+ "<Contains>"+ "<FieldRef Name='Title' />"+ "<Value Type='Text'>" + StudName + "</Value>" + "</Contains>" + "</Where>" + "</Query>" + "<RowLimit>10</RowLimit>" + "</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) { // Your Code Here } function onQueryFailed(sender, args) { // Your Code Here }
Update: Check for multiple fields with Contains CAML query is as below:
<Or> <Or> <Contains> <FieldRef Name='Field1' /> <Value Type='Text'>2</Value> </Contains> <Contains> <FieldRef Name='Field2' /> <Value Type='Text'>4</Value> </Contains> </Or> <Or> <Contains> <FieldRef Name='Field3' /> <Value Type='Text'>2</Value> </Contains> <Contains> <FieldRef Name='Field4' /> <Value Type='Text'>4</Value> </Contains> </Or> </Or>
Hope this helps!