MUi framework ajax request WebService interface instance, muiwebservice

Source: Internet
Author: User

MUi framework ajax request WebService interface instance, muiwebservice

The instance is as follows:

Mui. init (); mui. plusReady (function () {document. getElementById ('login '). addEventListener ('tap', function () {var UserName = document. getElementById ("account "). value; var Userpassword = hex_md5 (document. getElementById ("password "). value); mui. ajax (' http://XXXXX/Login.asmx/MgLogin ', {Data: "{'loginname':'" + UserName + "', 'Password':'" + Userpassword + "', 'identifies': '123 ', 'code': ''}", type: 'post', // dataType: 'json' of the HTTP request type, // The server returns the json format data timeout: 10000, // The timeout value is set to 10 seconds. headers: {'content-type': 'application/json'}, success: function (data) {// The server returns a response, analyze whether the logon is successful based on the response results; var jsons = data. d; var str = JSON. parse (jsons); if (str ["StatusCode"] = "200") {mui. alert ("Login successful");} else {mui. alert ("Logon Failed") ;}}, error: function (xhr, type, errorThrown) {// exception handling; mui. alert (type); console. log (type );}});});});

Note: If the returned format is incorrect, the system prompts "abort ".

The above MUi framework ajax request WebService interface instance is all the content shared by Alibaba Cloud xiaobian. I hope to give you a reference and support for the customer's house.

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.