6
I made a web application, with Angularjs and PHP, here on my computer, where I registered users and emails in the database and works perfectly.
I’m trying to do the same with Ionic, but when I try to insert, register a user, the following message is displayed on the console:
http://localhost:8888/systems/systems_web/Ionic/crudAngular/www/php/save.php 500 (Internal Server Error)......Ionic.bundle.js:19341 POST
- Does anyone know why this message?
- What am I doing wrong?
Check the server logs, because error 500 happens there. It could be a syntax error in the code, or an issue with the values you’re posting (or failing to post).
– bfavaretto
How to access these logs, @bfavaretto? The server is local.
– GustavoSevero
It depends on the server. But it’s easier for you to look at the request response in the "network" tab of Chrome tools. There should be a message.
– bfavaretto
All right, I’ll take a look at that. @bfavaretto, you’ve already developed some mobile app on Ionic?
– GustavoSevero
No, I never developed with Ionic.
– bfavaretto
No warning appears in the network tab... But in the console, I click on the black arrow in the message notice posted and a lot of things appear: > (Anonymous Function) @ ionic.bundle.js:19341
sendReq @ ionic.bundle.js:19160
status. $get.serverRequest @ ionic.bundle.js:18872
processQueue @ Ionic.bundle.js:23394 (Anonymous Function) @Ionic.bundle.js:23410 Parent. $get.Scope. $Eval @Ionic.bundle.js:24673
– GustavoSevero
In the network tab the HTTP request has to appear as soon as it is made. Clicking on it you can see the response. This which you have now shown is client-side, but your error is on the server.
– bfavaretto
Nothing @bfavaretto... HTTP request does not appear in the network tab. Have a look at my code: > https://github.com/GugaSevero/crudAngular-Ionic/tree/master/www
– GustavoSevero
You need to check whether (1) your js is sending valid json in the request body, and (2) whether the 3 keys/fields you try to use in the code are available in this json.
– bfavaretto
@bfavaretto, I have a web application that does the same thing and works... I would have to do this conference on js and check if these 3 keys are correct?
– GustavoSevero
You have to find a way to check what is being received by php.
– bfavaretto
Yeah, with angular, it’s hard to see what’s coming in php using Postman.
– GustavoSevero
The problem is that you cannot access http://localhost:8888 within an app, you have to set your machine’s IP address, make your machine’s IP point to the localhost, or use a remote server. , to know the IP (in osx/linux: ifconfig, in window: ipconfig), set this in . htdocs
– Ivan Ferrer