Using an API Using HTTP JSON POST ...
Hi,I have the below code ... am trying to use an API from sms gateway provider and use it to send sms ... this i want to do in html5. below is the code but its not working. can someone please help me.
<!DOCTYPE html>
<html>
<title>My jQuery JSON Web Page</title>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
JSONTest = function() {
var resultDiv = $("#resultDivContainer");
$.ajax({
url: "http://hi.com/SendSMS",
type: "POST",
data: JSON.stringify({ "Username": "9xxxxxx",
"Password": "xxxxxx",
"Tagname": "abcd",
"RecepientNumber": "0xxxxxxx",
"VariableList": "",
"ReplacementList": "",
"Message": "test",
"SendDateTime": 0,
"EnableDR": False }),
dataType: "json",
success: function (result) {
switch (result) {
case true:
processResponse(result);
break;
default:
resultDiv.html(result);
}
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
};
</script>
</head>
<body>
<h1>My jQuery JSON Web Page</h1>
<div id="resultDivContainer"></div>
<button type="button" onclick="JSONTest()">JSON</button>
</body>
</html>