The result obtained from the data requested by PHPajax is in Html format, which is the html of the current page. if the conversion fails to be in json format, the request is cracked.

Source: Internet
Author: User
This is the code. you must change the format of dataType to html to obtain the data. Otherwise, the error error200 will be reported. $. Ajax ({code...} is the code. you must change the dataType format to html to obtain the data. otherwise, error 200 is reported. $. Ajax ({

                                type:"POST",                                async:false,                                url:"
  generateURL('Film.Index', array('save'));?>",                                data:dataparam,                                dataType:"json",                                success:function(msg){

Reply content:

This is the code. you must change the format of dataType to html to obtain the data. otherwise, error 200 is returned. $. Ajax ({

                                type:"POST",                                async:false,                                url:"
  generateURL('Film.Index', array('save'));?>",                                data:dataparam,                                dataType:"json",                                success:function(msg){

Set the header on the server. no output is allowed before the header.

header('Content-type: application/json');

Data assembled by the server

echo json_encode($var);

This is because your server did not return your expected JSON format. you can print the output on the server.

That is, the data returned by the server is not in json format, not the front-end.

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.