thanks mahender,i did like this it worked,i included the webAPi code to create record inside the html script tags
<html>
<head>
<script type="text/javascript">
function createAccount() {
var serverURL = window.parent.opener.Xrm.Page.context.getClientUrl();
var complaint= new Object();
complaint["new_name"] = document.getElementById("cid").value;
var req = new XMLHttpRequest();
req.open("POST",serverURL + "/api/data/v9.0/new_complaints", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.onreadystatechange = function () {
if (this.readyState == 4) {
req.onreadystatechange = null;
if (this.status == 204||this.status == 200) {
var complainttUri = this.getResponseHeader("OData-EntityId");
alert("Created complaint with URI: " + complainttUri)
} else {
var error = JSON.parse(this.response).error;
alert(error.message);
}
}
};
req.send(JSON.stringify(contact));
}
</script>
</head>
<body>
Complaint name: <input name="CName" id="cid" type="text">
<button onclick="createAccount()"> CREATE </button>
</body>
</html>