用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1808|回复: 1
收起左侧

[HELP] 请教一个关于ci和ajax得问题~~~

[复制链接]
发表于 2013-1-13 18:50:23 | 显示全部楼层 |阅读模式

  1. 目录:

  2. 127.0.0.1/ci/
  3.                    application\controllers\test.php
  4.                    application\views\test_v.php
  5.                    js\script\test_j.js


  6. 在test_v.php中 引入了test_j.js文件

  7. test_j.js中是jquery得ajax代码:
  8. var dataString = 'name=1&email=2&phone=3';
  9.                 $.ajax({
  10.                         type:    'post',
  11.                         url:     '/index.php/test/check',
  12.                         data:    dataString,
  13.                         dataType:'text',
  14.                         success:function(msg){
  15.                                   
  16.                         },
  17.                         error:function(){
  18.                                 alert("错误");
  19.                         }
  20.                 })

  21. test.php:
  22. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  23. class Test extends CI_Controller
  24. {
  25.         public function index()
  26.         {
  27.                 $this->load->view('test_v');
  28.         }

  29.         public function check()
  30.         {
  31.                 $name = $_POST['name'];
  32.                 $email = $_POST['email'];
  33.                 $phone = $_POST['phone'];
  34.         }
  35. }

  36. 运行网页~~test_v文件向控制器发送信息~~但有错误~~怎么改啊?  我刚学CI框架



复制代码
发表于 2013-4-7 09:28:12 | 显示全部楼层
请问楼主这个问题解决了没,我最近遇到这个问题了!!!

本版积分规则