I want to get data from
this domain ![
^]
( I will will edit source of the code of the above mentioned domain from chrome and paste the code , then through jquery timer I will fire post request to send data to specific interval to a separate domain .
Other words send data from
ABC Home Page - ABC.com[
^] to
http://www.mydomain.com/ReqData.asmx[
^] using JQUERY .
and want to post the data to
http://www.mydomain.com/ReqData.asmx/SDT[
^]
I have implemented
jsonp
but getting error while posting data.
Error :
GET http:
IIS Eror Log -
2019-01-04 06:41:40 172.31.80.6 GET /WebRequest.asmx/SDT callback=jQuery21300395526289036674_1546584101987&{%22KeyV1%22:%224%22,%22KeyV2%22:%222019%22,%22ScriptName%22:%22ITC%22,%22OpenVal%22:%22100%22,%22CloseVal%22:%22100.2%22,%22HighVal%22:%22101%22,%22LowVal%22:%2299.5%22}&_=1546584101988 80 - 157.40.70.220 Mozilla/5.0+(Windows+NT+6.1;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/71.0.3578.98+Safari/537.36 - 500 0 0 531
Please help .
What I have tried:
$.ajax({
type: "POST",
contentType: 'application/json; charset=utf-8',
dataType: 'jsonp',
crossDomain: true,
url: 'http://www.mydoman.in/ReqData.asmx/SDT',
headers: {
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Origin": "*",
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: JSON.stringify({
KeyV1: "4",
KeyV2: "2019",
ScriptName: "ITC",
OpenVal: "100",
CloseVal: "100.2",
HighVal: "101",
LowVal: "99.5"
}),
success: function (result) {
alert(JSON.stringify(result));
},
error: function (xhr, status, error) {
alert(status);
}
});