1. The YII framework used in the project has a method in Usertest.php under the module:
public function getTextArea($fieldName,$usertest_id) { return CHtml::activeTextArea($this,$fieldName,array("name"=>$fieldName."_".$usertest_id,'style'=>'rows:3;cols:20;',"ajax" => array("type"=>"POST","url"=>"/usertest/ChangeComments", "data"=>array("usertest_id"=>$usertest_id,"usertest_comments"=>"js:this.value"),"success"=>"js:alert(\"Update comments success!\")"))); }
array( 'name' => 'usertest_comments', 'id' => 'usertest_comments', 'header'=>'Comments', 'type'=>'raw', 'value'=>'$data->getTextArea(\'usertest_comments\',$data->usertest_id)', 'htmlOptions'=>array('style'=>'width:100px;'), ),
public function getTextArea($fieldName,$usertest_id) {
return CHtml::activeTextArea($this,$fieldName,array("name"=>$fieldName."_".$usertest_id,"style"=>"rows:3;cols:20;","ajax" => array("type"=>"POST","url"=>"usertest/ChangeComments","data"=>array("usertest_id"=>$usertest_id,"usertest_comments"=>"js:this.value"),"success"=>"js:alert(\"Update comments success!\")")));
}
Baidu, after changing it according to this article (click to open the link), it's OK . Later, I removed the absolute path and left only "dataType" => "JSONP", which seemed to be no problem.
3. Anyway, the program always went back and forth, and finally the problem was solved like this
The above introduces the duplication of URL paths during Ajax requests under Linux PHP, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.