How to user registered restRoutes urls

public void Register(IRestEndpointController restRoutes)
restRoutes.Add(2, "baaccp/getstate/{stateId}", new { }, null, HttpMethod.Get, GetState);

above is my snip code. I am trying to add rest routes and trying to Ajax call on create user page. As per My understanding I am unable to call Ajax. But may be this route register will be alternate way. If yes Please tell me How I can use in .vm.