Invoke WebService with JavaScript (WebService behavior)

Source: Internet
Author: User
<script language= "JavaScript" >
function Getfemale ()
{
The first argument is the URL of the webservice, followed by the name
Female.useservice ("News.asmx?") WSDL ", News");
Set a callback function, the service returns the result of the callback; The first parameter is the name of the callback function, followed by the WebService parameter
Intcallid=female.news.callservice (Female_result, "Getphoto", "female"); Here are two parameters ...
}
function Female_result (Result)//callback functions
{
if (result.error)
{
female.innerhtml=result.errordetail.string;
}
Else
{
Female.innerhtml=result.value; Write the results returned by WebService as Div
}
}
</script>
Page Display section: <div id= "female" style= "Behavior:url (WEBSERVICE.HTC)" ></div>
OK, which provides a way for us to invoke dynamic content on the static page;
Here, if you add a timed call to the Getfemale () function, it's a mechanism to refresh the page without updating it.
The disadvantage is that webservice will have a certain delay, even if the local webservice will be slower than the static page, the initial opening of the page will feel very uncoordinated.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.