Kod
$(document).ready(function(){
$('#submit_post').click(function(){
var uid = 1;//$_SESSION['id'].val();
var comment = $('#postbox').val();
var pid = 6;//$_GET['post'].val(); //static post id
if (!comment.trim()) {
//alert('Wpisz komentarz!');
$('#komentarzError').modal('show');
return false;
}
$.ajax({
url:'/inc/functions/add-comment.php',
type:'post',
dataType:'html',
//data:'uid='+uid+'&comment='+comment+'&pid='+pid,
data : {uid: uid, comment: comment, pid: pid},
success:function(data){
if(! data ){
alert('Coś poszło nie tak!');
return false;
}
//$(data).hide().prependTo("#comment_thread").fadeIn(1000);
$('#comment_thread').prepend(data).fadeIn(1000);
//reset input boxes
$('#postbox').val('');
}
});
});
});
$('#submit_post').click(function(){
var uid = 1;//$_SESSION['id'].val();
var comment = $('#postbox').val();
var pid = 6;//$_GET['post'].val(); //static post id
if (!comment.trim()) {
//alert('Wpisz komentarz!');
$('#komentarzError').modal('show');
return false;
}
$.ajax({
url:'/inc/functions/add-comment.php',
type:'post',
dataType:'html',
//data:'uid='+uid+'&comment='+comment+'&pid='+pid,
data : {uid: uid, comment: comment, pid: pid},
success:function(data){
if(! data ){
alert('Coś poszło nie tak!');
return false;
}
//$(data).hide().prependTo("#comment_thread").fadeIn(1000);
$('#comment_thread').prepend(data).fadeIn(1000);
//reset input boxes
$('#postbox').val('');
}
});
});
});
Czy jeżeli zrobię coś takiego w nagłówku, to czy zmienną "id_sesji" będę mógł normalnie odczytać w jakimś pliku js?
<script type="text/javascript" > </script>