Hi:
Because my API server can not input and output startard JSON format, (use javascript object)
Can some one tell me, way can’t get value ?
function login(){
var obj3={wa99:"{\"class_name\":\"member\",\"function_name\":\"siteStatus\"}"};
// fetch API
fetch('https://tstgen.tg7777.net/iapi/post.php',{
headers:{
'Content-Type':'application/x-www-form-urlencoded'
},
method:'post',
body: {wa99:"{\"class_name:\"member\",\"function_name\":\"siteStatus\"}"}
}).then(function(response){
return response;
}).then(function(value){
console.log(value);
});
}
if I use jquery like the
var obj3={wa99:"{\"class_name\":\"member\",\"function_name\":\"siteStatus\"}"};
var settings = {
"async": true,
"crossDomain": true,
"url": "https://tstgen.tg7777.net/iapi/post.php",
"method": "POST",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
"data": obj3
}
$.ajax(settings).done(function (response) {
if (response.errorCode=='000'){
console.log('OK');
}
else {
}
})
I will get value very easy, How can I do , if I want use fetch() api ?