VF:
<apex:page controller="jsclass">
<apex:form >
<script>
function getValue(){
var fieldValue = document.getElementById('test').value;
Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.jsclass.addAccounts}',acc,function(result, event)
{
if (event.status)
{
document.getElementById("{!$Component.theBlock.pbs.pbs1.accId}")
.innerHTML = result.Id;
}
},{escape:true});
}
</script>
<apex:inputtext id="test"/>
<apex:pageBlock id="theBlock" >
<apex:pageBlockSection id="pbs" >
<apex:pageblocksectionitem id="pbs1">
<apex:outputtext id="accId">
</apex:outputtext>
</apex:pageblocksectionitem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
class:
public class jsclass {
public string acc {get; set;}
public account a {get; set;}
@RemoteAction
public static void addAccounts(string acc){
String ac = acc.Substring(0,acc.length()-1);
Account a =[Select Id from account where name like'%ac'];
system.debug(a);
}
}
String acLike = '%' + ac;
andname like :acLike
. But you are returning nothing either so its hard to see what you are trying to do.