Gmiservice example, Using javascript – Grandstream GXP2200 GMI Web Service Guide User Manual

Page 38

Advertising
background image

GXP2200 GMI WEB SERVICE GUIDE V1.0

Page 37 of 38

GMIService EXAMPLE

USING JAVASCRIPT

Add the following code in the file webservice.html.

<script language="javascript" src="js/WebService.js"></script>

<script type="text/javascript">

function showLogin(data)

{

if(data.res == "success")

{

$("#connectresult").html("<font color='red'>Connect success</font>");

}

}

function login()

{

ip = $("#ip").val();

username = $("#username").val();

password = $("#password").val();

webService.webServiceLogin(ip, username, password, showLogin);

}

</script>

...

<div id="connectinfo">

Phone IP: <input id="ip" value="Input Phone IP here">

UserName: <input id="username" value="admin">

Password: <input id="password" value="admin">

<button onclick="login()">Connect</button>

</div>

<br>

<h4>2. Connect info</h4>

<div id="connectresult">

not connected

</div>

...

Advertising