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?
.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.
You will need to use $data['video'] = $this->input->get('video')
.load()
uses the get
method.
To do a post
you can do:
var url = "http://www.....";
$.post(url, {video: 'platforms-lasers'}, function(data){
$('#platforms-lasers-video').html(data);
});
Although this seems to be answered for future reference you can also use:
$data['video'] = $this->input->get_post('video')
This function will search through both the post and get streams for data, looking first in post, and then in get.