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.