Simple record that $. getJSON does not execute at a time. getjson execution record
When someone else's code is called, it finds that the modification function cannot be used. When the modification is made, json is sent through ajax to obtain the data. The chrome developer tool finds that data is sent and the return value is returned;
Initiate a request and obtain data. The callback function is not executed!
$.getJSON(site_url+'?m=test&a=getOne',{id:id},function(d){ if(d.status){ vardata=d.data; $('input[name="id"]').val(data.id); $('input[name="name"]').val(data.name); }else{ Message.fairue(d.info); setTimeout(function(){ // todo },2000); }});
Php return data code:
if($findOne){ $this->ajaxReturn($findOne,'success',true);}else{ $this->ajaxReturn($findOne,'faild',false);}
The returned data also looks normal in the browser:
{"Data": {"id": "1", "name": "admin",}, "info": "success", "status": true}
Adjusted for half a day...
Some people say it is a json format problem, some say it is a parameter problem, and I am not familiar with js. After troubleshooting, I will eliminate it one by one...
Paste the json data returned by the browser to vim and find that:
<Feff> {"data": {"id": "1", "name": "admin",}, "info": "success", "status ": true}
<Feff> ??? Bomb...
Attachment: vi bomb operation:
# Add BOM: set bomb # Delete BOM: set nobomb # query BOM: set bomb?
Find all files in the current directory that contain bomb:
grep -I -r -l $'\xEF\xBB\xBF' ./
The final result is that/Conf/config. php has bomb, which is modified...
Project framework: ThinkPHP
The simple record of $. getJSON not executed in the preceding section is all the content shared by Alibaba Cloud. I hope you can give us a reference and support for the customer's house.