doutangguan2460 2011-12-09 17:03
浏览 85
已采纳

如何通过jQuery传递post变量?

I have this jQuery call in a click event:

var url = "http://www.....";
$('#platforms-lasers-video').load(url + ' #platforms-lasers', {video: 'platforms-lasers'});

I am using CodeIgniter and pass $data['video'] = $this->input->post('video') to the view, making sure to pass $data to the view.

I echo like this:

<div id="<?php echo $video; ?>">

    <div id="video">
        <video width="650" height="360" controls="controls" preload="auto" poster="<?php echo base_url(); ?>images/features/<?php echo $video; ?>.jpg">
          <source src="<?php echo base_url(); ?>videos/<?php echo $video; ?>.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
          <source src="<?php echo base_url(); ?>videos/<?php echo $video; ?>.webm" type='video/webm; codecs="vp8, vorbis"' />
          <source src="<?php echo base_url(); ?>videos/<?php echo $video; ?>.ogv" type='video/ogg; codecs="theora, vorbis"' />
          <object id="flash_fallback_1" class="vjs-flash-fallback" width="650" height="360" type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf">
            <param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf" />
            <param name="allowfullscreen" value="true" />
            <param name="flashvars" value='config={"playlist":["<?php echo base_url(); ?>images/<?php echo $video; ?>.jpg", {"url": "<?php echo base_url(); ?>videos/<?php echo $video; ?>.mp4","autoPlay":false,"autoBuffering":true}]}' />
            <img src="<?php echo base_url(); ?>images/<?php echo $video; ?>.jpg" width="650" height="360" alt="" title="<?php echo $v->no_playback; ?>" />
            <a href="http://www.adobe.com/go/getflash">
                <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="<?php //echo $v->get_flash; ?>" />
            </a>
          </object>
        </video>
       </div>


   </div>

But the post variable isn't being passed to the view. How do I do that?

  • 写回答

3条回答 默认 最新

  • dovs36921 2011-12-09 17:07
    关注

    .load() uses the GET method.

    This method is the simplest way to fetch data from the server. It is roughly equivalent to $.get(url, data, success) except that it is a method rather than global function and it has an implicit callback function.

    from jQuery .load() manual

    You will need to use $data['video'] = $this->input->get('video')

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 本地测试网站127.0.0.1 已拒绝连接,如何解决?(标签-ubuntu)
  • ¥50 Qt在release捕获异常并跟踪堆栈(有Demo,跑一下环境再回答)
  • ¥30 python,LLM 文本提炼
  • ¥15 关于将inet引入的相关问题
  • ¥15 关于一个倒计时的操作和显示设计
  • ¥15 提问STK的问题,哪位航天领域的同学会啊
  • ¥15 苹果系统的mac m1芯片的笔记本使用ce修改器使用不了
  • ¥15 单相逆变的电压电流双闭环中进行低通滤波PID算法改进
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 如何卸载arcgis 10.1 data reviewer for desktop