[SOLVED] Correct way to retrieve data from SQL


I currently have a PHP script that returns the correct JSON data from SQL DB that I want, however I’m unable to get the data from my AJAX JS call. I feel like I’m missing something key.

Note: I have dataType set to text temporarily since json is super script, I just wanted to be able to see the error. I get the whole PHP script sent back.

	type: 'GET',
	url: 'myscript.php',
	dataType: 'text',
	success: function(data){
		// do stuff
	error: function(data){
		// fix stuff

Check the console on the browser you are testing in for fails.

If the PHP script has a syntax error, it’ll 500 and may not trigger the error event.

Further more you are making a request to a local resource which you won’t be able to do on production

Do you have any tips on backend database configuration?

I was actually able to get the process working. I’ve successfully created and call a Web Server that does the job just as intended!