1. 项目用的yii框架,在module下面的usertest.php有一个方法:
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!\")")));
}
百度了下,按照这个文章(点击打开链接)改了之后,可以了。后面把绝对路径去掉,只留下"dataType"=>"JSONP", 貌似也没有问题。
3. 反正程序总是来回折腾,最后就这样解决了问题
立即学习“PHP免费学习笔记(深入)”;
以上就介绍了linux php下Ajax请求时URL路径出现重复,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号