简体   繁体   中英

how to Call a specific method of my Web Service from java script?

i am trying to call a web service from my pure HTML page using java script. i had successfully created a web service using java on net beans. now i want to call a method from that web service using java script with sending some parameters to the web Service, i had tried so far but not succeed yet. i had successfully called the method using jsp page, but i need to do it by using simple html page.

i had seen an example Here but it is not working with me. :(

can you please give me some example, so that i come to know how to call a specific method of my web service from java script with sending some parameters to the web service.

thanks in advance.

EDIT

my script

    function validateForm(frm)
{ 
document.forms[0].action="http://localhost:8084/Web_Service_Example/CircleFunctions?"
document.forms[0].method="post"
document.forms[0].submit()
}

my CircleFunctions method

public class CircleFunctions {
public int sum()

{
    int a = 20;
    int b = 40;

    int c = a+b;

    return c;
}
}
document.forms[0].action="http://localhost:8080/webservice/services/add"
document.forms[0].method="get"
document.forms[0].submit()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM