POST is not working with strange error
See original GitHub issueHi, I can do a GET request without any problems. The PHP script also works well for POST requests, but when I do a POST request from my ionic app, I always get this error:
{"__zone_symbol__currentTask":{"type":"microTask","state":"notScheduled","source":"Promise.then","zone":"angular","cancelFn":null,"runCount":0},"line":86,"column":22,"sourceURL":"file:///var/containers/Bundle/Application/FAC1A964-4A4A-4081-B9DA-B3D3F1E1BEC1/App.app/www/plugins/cordova-plugin-advanced-http/www/helpers.js"}
I couldn’t find any help so far. Am I doing something wrong? Here is my ionic code:
let postData = new FormData()
postData.append('s_id',this.s_id)
postData.append('klasse',this.klasse.id)
postData.append('stunde',this.stunde.id)
postData.append('uebungen',JSON.stringify(this.uebungen))
postData.append('wo_id',woid)
const options = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
};
this.http.post(
'URL.php/',
postData,
options
)
.then(response => {
// prints 200
console.log("Response-Status: "+response.status);
try {
response.data = JSON.parse(response.data);
// prints test
console.log("Response-Message: "+response.data.message);
} catch(e) {
console.error('JSON parsing error');
}
})
.catch(response => {
// prints 403
console.log("Response: "+JSON.stringify(response));
}
});
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
javascript - Post request with strange behavior
I ran the application totally in my local environment (changed my request to my local server as opposed to the one hosted on...
Read more >POST request not properly authenticated error? (Get ...
I'm trying to figure out why I get an error saying “This request is not properly authenticated” when trying out the following command?...
Read more >Topic: Strange error on post
I have a band messageboard that's worked flawlessly for a year now… but when I tried posting myself just now, it didn't appear...
Read more >Solved: Re: [Strange Error]: Unable to connect to the data ...
1) my developer generated a link to the datasource which returns the data into the format of JSON. This data is before 06/04/2022....
Read more >11 Common Facebook Problems and Errors (And How to ...
Here are fixes for the most annoying Facebook issues and errors you'll come ... We all know someone who posts all the time...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @bastifix you can use adb logcat in the terminal to check out more about you error in low level of your app.
I usually install my app on one device and use chrome://inspect/#devices and logcat to debug my Ionic application.
cheers.
Closing this, feel free to open a new issue, if this won’t solve your problem! 👍