Thinkphp的ajax提交的有关问题

WBOY
Release: 2016-06-13 12:48:32
Original
794 people have browsed it

Thinkphp的ajax提交的问题
在做ajax提交的过程中遇到两个问题。
1:在使用ajax提交到一个action的method中之后,我又使用$this->upload()的方式调用了另一个方法。在这个方法中有需要返回错误或者成功的信息,所以使用了【return...】返回一个值,可是这个值就直接返回给前台了。。我想的是应该从提交到的method中返回到前台。。

2:使用$this->isAjax()判断返回错误,我是使用thinkajax提交的表单,所以在form下添加了一个可是还是判断不成功。。

请大家不吝赐教。。

PHP,ajax
------解决方案--------------------
  if (!$upload->upload()){
                  return $this->error($upload->getErrorMsg());              }else{
                  return $upload->getUploadFileInfo();
                            }
     }

改成:
  if (!$upload->upload()){
                  $this->assign("jumpUrl","你要跳转的method地址");
                   $this->error($upload->getErrorMsg());              }else{
                  return $upload->getUploadFileInfo();
                            }
     }
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template