To test whether jquery calls a third-party WebService, it uses jquery's $. Get (URL, Data, callback) to call a WebService that can be queried locally on a mobile phone.
PS: http://www.webxml.com.cn/zh_cn/index.aspx website provides a lot of useful simple WebService.
<HTML xmlns = "http://www.w3.org/1999/xhtml"> <br/> <pead> <br/> <title> jquery test </title> <br/> <MCE: script src = "http://code.jquery.com/jquery-1.4.3.js" mce_src = "http://code.jquery.com/jquery-1.4.3.js" Language = "JavaScript"> </MCE: SCRIPT> <br/> <MCE: script Type = "text/JavaScript" Language = "JavaScript"> <! -- <Br/> $ (document ). ready (function () {<br/> $ ("# btnget "). click (function () {<br/> var url = "http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx/getMobileCodeInfo"; <br/> var mobile = $ ("# txtmobile "). val (); <br/> $. get (URL, {mobilecode: Mobile, userid: ""}, function (data) {<br/> var result = $ (data ). first (). text (); <br/> $ ("# divresponse "). text (result); <br/> }); </P> <p> // --> </MCE: SCRIPT> <br/> </pead> <br/> <body> <br/> <p> jquery mobile phone number attribution query </p> <br/> <div> <br/> mobilecode: <input id = "txtmobile" type = "text" style = "width: 100px "/> <br/> <input type =" button "id =" btnget "value =" get "style =" width: 80px "/> <br/> </div> <br/> <HR/> <br/> <Div id =" divresponse "> <br/> </div> <br/> </body> <br/> </ptml>
This service (http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx? OP = getmobilecodeinfo) requires two parameters: mobilecode and userid, which are assembled in JSON format. You can call http get. The procedure is simple and entertaining.
The running result is as follows: