I have a RESTful web service (java) , and I want to send a get request by a submit button to the web service.
The function in the web service that called "test" will take a string from a text input in the html page and return a string , then I need to take the string and put it in an paragraph tag without refresh the page
Here is my code :
The html page :
<input type="text" id="equation_input">
<input type="button" value="Calculate" id="equation_submit" onclick="fun()">
<p id="value"></p>
The RESTful web service :
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.tarek.doctorMath.resources.test.*;
@Path("/first")
public class first_equation {
@GET
@Path("/{test}")
@Produces(MediaType.TEXT_PLAIN)
public String test(@PathParam("test") String equation) {
return "test";
}
}
can anyone help me?