|
- 目录:
- 127.0.0.1/ci/
- application\controllers\test.php
- application\views\test_v.php
- js\script\test_j.js
- 在test_v.php中 引入了test_j.js文件
- test_j.js中是jquery得ajax代码:
- var dataString = 'name=1&email=2&phone=3';
- $.ajax({
- type: 'post',
- url: '/index.php/test/check',
- data: dataString,
- dataType:'text',
- success:function(msg){
-
- },
- error:function(){
- alert("错误");
- }
- })
- test.php:
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- class Test extends CI_Controller
- {
- public function index()
- {
- $this->load->view('test_v');
- }
- public function check()
- {
- $name = $_POST['name'];
- $email = $_POST['email'];
- $phone = $_POST['phone'];
- }
- }
- 运行网页~~test_v文件向控制器发送信息~~但有错误~~怎么改啊? 我刚学CI框架
复制代码 |
|