Hide var data on ajax
I am making ajax like function but i have problem that bad user can change
the value into any other current user. So, how can i prevent this thing ?
$live = 'user1';
$fol = 'user2';
function ajax(like){
var data = 'like='+like+'&CURRENTUSER=<?php echo $live; ?>&TOFOLLOW=<?php
echo $fol; ?>';
$.ajax({
type: 'POST',
url: 'ajax.php',
data: data,
success: function(e){
$('#success').html(e);
}
});
}
Also i want to move this ajax function into ajax.js file, but i am have
problem in getting the value $live and $fol of users because echo $live
doesn't work on .js. So, is there any way to do this like Facebook,
Twitter ajax function does ?
No comments:
Post a Comment