Javascript-ajax successfully returned JSON data, but was prompted with a 500 error.

Source: Internet
Author: User
Keywords Ajax php javascript
Tags php error php error log

Using AJAX to request data asynchronously, the data has been successfully returned but the browser prompts a 500 error.

Test succeeded on localhost. However, an error occurred after uploading to the Ubuntu virtual machine.

Reply content:

Using AJAX to request data asynchronously, the data has been successfully returned but the browser prompts a 500 error.

Test succeeded on localhost. However, an error occurred after uploading to the Ubuntu virtual machine.

The front-end code does not see anything.

500 is a syntax error in the code, it should be a syntax error in admin.php

Compare requests in both local and Ubuntu 2 environments first
But I think it's your local environment and the environment in Ubuntu caused some grammatical errors, including PHP version and Apache (Nginx)

The backend program starts with these aspects: 1. Returned data format error 2. Procedural error 3. Server-side error,

See if there's a problem with the path to PHP? See if the returned data is complete?

It is recommended that all errors be turned on.
For example, code open Error alert:


  
   

Then remember to check the PHP error log.
Nginx error Log
Error log for PHP-FPM
In some cases, I reported a 50x error. The system is not prompted. Is logged in the error log. Take a closer look at yourself.

Server environment is caused by the majority of the reasons, Ubuntu, check the permissions it. In addition to the landlord to make a suggestion. Local development. It's best to use vagrant or Docker to build your development environment. Wamp and other integrated environments for learning

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.