I have been provided with an ajax API to read data from client PHP portal.
I have this code working:
<!DOCTYPE HTML >
<html>
<head>
<title>Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
function runTest() {
var dataToSend = {
'format': 'XYZ-2.0',
'ops': {
resource: 'client-Read',
testOps: [
{
action: "Read",
resource: "client",
value: {
"fSalary": 50000,
"fHomeMortgage": 400000,
"aInsurance": {
"coverLife": 155000
},
"aPersonalDetails": {
"strName": "John Smith"
}
}
}
]
}
};
jQuery.ajax(url+'/api/v3', {
type: 'POST',
data: JSON.stringify(dataToSend),
contentType: "application/json; charset=utf-8",
dataType: "jsonp",
success: function (data) {
alert(data);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
}
</script>
</head>
<body>
<form id="form1">
<input id="button1" type="button" OnClick="runTest();" value="Test"> </input>
</form>
</body>
</html>
How can I convert it to C#? in other words, how can I consume the same service using server side coding. the js array is confusing me.
Thanks