i have this ajax code
<script>
$(document).ready(function(){
$('ul#tab li:first').html('<?php echo $channel;?>');
$('ul#tabs li').on("click",function(){
// $('ul#tab li.active').html($(this).html());
$('ul#tab li').html("");
//$('ul#tab li.active').html($(this).html());
var index = $( "ul#tabs li" ).index( $(this) );
$.post("../admin/ajax/ch1.php", {index: index}, function(result){
$('ul#tab li.active').html(result);
});
});
});
</script>
and in the php ch1.php is
<?php
$ch1tab1= file_get_contents("../channels/ch1tab1.html");
$ch1tab2= file_get_contents("../channels/ch1tab2.html");
$ch1tab3= file_get_contents("../channels/ch1tab3.html");
$ch1tab4= file_get_contents("../channels/ch1tab4.html");
$ch1tab5= file_get_contents("../channels/ch1tab5.html");
$channel = $_POST['index'];
if ($_POST['index'] == 0 ){ $channel = $ch1tab1;}
else if ($_POST['index'] == 1){ $channel = $ch1tab2;}
else if ($_POST['index'] == 2 ){ $channel= $ch1tab3;}
else if ($_POST['index'] == 3 ) {$channel = $ch1tab4;}
else if ($_POST['index'] == 4 ) {$channel = $ch1tab5;}
echo $channel; ?>
the varible ch1tab4 have a code , and it is not work , echo blank what i should to do plz ?
Aucun commentaire:
Enregistrer un commentaire