source: sandbox/webservice/restclient_new/exemplo/exemplo.html @ 7820

Revision 7820, 2.1 KB checked in by alexandrecorreia, 11 years ago (diff)

Ticket #2507 - Ajustando a index e o exemplo do novo resclient.

  • Property svn:executable set to *
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3        <head>
4                <title>.:: ExpressoLivre - API REST ::.</title>
5                <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
6                <meta name="author" content="Equipe Expresso Livre" />
7                <meta name="keywords" content="rest, json, javascript" />
8                <meta name="description" content="Cliente para demonstra&ccedil;&atilde;o do RECURSO REST" />
9                <!--CSS-->
10               
11                <!--JavaScript-->
12                <script type="text/javascript" src="jquery-1.9.0.min.js"></script>
13                <script>
14
15                        function expressoVersion()
16                        {
17                                $.ajax(
18                {
19                        type    : "POST",
20                    url         : "client_rest.php",
21                    data        :
22                    {
23                            id          : "",
24                            params      : "", 
25                            serverUrl   : "http://expresso.pr.gov.br/api/rest/ExpressoVersion",
26                            methodType  : "POST"
27                    },
28                    beforeSend: function()
29                    {
30                        // Coloque aqui seu código;
31                        $("#resposta").html("<span style='color:red'>( Aguarde ..... )</span>");
32                                        },
33                    success: function(response)                         
34                    {
35                        //Coloque aqui seu código;
36                        var obj = jQuery.parseJSON(response);
37                       
38                        $("#resposta").html( "Id : " + obj.id + "<br>" +
39                                        "Expresso Vers&atilde;o : " + obj.result.expressoVersion +
40                                        "<br> Vers&atilde;o da API : " + obj.result.apiVersion );
41                    },
42                    error: function(response)
43                    {
44                        console.log("Error : " + response );
45                        }       
46                });
47                        }
48
49                </script>
50        </head>
51        <body>
52
53                <button onclick="expressoVersion();">Clique aqui</button>
54
55                <div style="font:12pt Verdana, sans, arial; margin:10px;">
56                       
57                        <label>Resposta : </label>
58
59                        <div id="resposta" style="padding:10px;"></div>
60                                                       
61                </div>
62        </body>
63</html>
64               
Note: See TracBrowser for help on using the repository browser.