thinkphp page jump, Ajax tips in detail (18)

Source: Internet
Author: User

Original: thinkphp page jump, Ajax tips Detailed Introduction (18)

thinkphp page jump, Ajax tips Detailed Introduction


First, page jump

$this->success (' query success ', U (' user/test '));
├─//Jump Current Module method:
├─ $this->success (' Query succeeded ', ' test ');
└─//jump to the specified jump module method
This->success (' query succeeded ', U (' user/test '));
$this->error (' query failed, 3 seconds after the jump will be before the page/previous page ');

Redirect to the category operation of the new module
$this->redirect (' new/category ', ', 5, ' page jump ... ');


Second, Ajax skills
Status Operation state
Info Tip Information
Data returned
$this->ajaxreturn (return data, prompt information, operation status);

Examples of Use
Module: IndexAction.class.php
<?php
Use of Ajax
Class Indexaction extends Action {
Public Function index () {
$this->display ();
}
Public function Getajax(){
The value of the pass can be found in the table data Ah ....
$this->ajaxreturn (' Le June Yang gives you the data information returned by Ajax ', ' Information 1 ', 1);
}

}
?>
corresponding Index.html page
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>Index</title>
<script src= "__public__/js/jquery.js" ></script>
<script>
$ (function () {
$ (' button '). Bind (' click ', function () {
$.get (' __url__/getajax', function (jdata) {
Print out the values to see
Alert (Json.stringify (Jdata));
if (jdata.status==1) {
$ (' div# did'). HTML (jdata.data);
}
});
});
});
</script>
<body>
<div style= ' height:50px;background:yellow ' id= ' did' ></div>
<button>ajax Click to get Data dynamically </button>
<script>
document.write (New Date ());
</script>
</body>

thinkphp page jump, Ajax tips in detail (18)

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.