|
|
|
รบกวนถามเรื่องการ selector ของ jQuery จากค่าตัวแปรของ php ครับ และส่งไปทาง url |
|
|
|
|
|
|
|
Code (PHP)
<script type="text/javascript">
$(document).ready(function(){
function last_msg_funtion()
{
var productCategory = "<?php echo (isset($productCategory) ? $productCategory : '' ;?>";
var ID=$(".message_box:last").attr("id");
$('div#last_msg_loader').html('<span>Loding</span>');
$.post("/e_com/scrolls/index?action=get&last_msg_id="+ID,
function(data){
if (data != "") {
$(".message_box:last").after(data);
}
$('div#last_msg_loader').empty();
});
};
$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - $(window).height()){
last_msg_funtion();
}
});
});
</script>
|
|
|
|
|
Date :
2014-01-12 22:14:09 |
By :
mariddew |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วจะส่ง ค่าของ productCategory
ใน url $.post("/e_com/scrolls/index?action=get&last_msg_id="+ID, อย่างไรครับ
|
|
|
|
|
Date :
2014-01-12 23:54:59 |
By :
kim_cmu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var productCategory = "<?php echo (isset($productCategory) ? $productCategory : '' ;?>";
|
|
|
|
|
Date :
2014-01-13 08:49:31 |
By :
{Cyberman} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
error ครับ
|
|
|
|
|
Date :
2014-01-13 11:33:23 |
By :
kim_cmu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ทำได้แล้ว ครับ จับมันใส่ในtag form และบวกตัวแปรเพิ่ม +"&productCategory="+productCategory เข้าใป
Code (JavaScript)
<form id='form'>
<input type="text" name="username" id="username" size="30" value="<?php echo $productCategory;?>">
</form>
<script type="text/javascript">
$(document).ready(function(){
function last_msg_funtion()
{
var productCategory = $.trim($('#form input[name=username]').val());
var ID=$(".message_box:last").attr("id");
$('div#last_msg_loader').html('<span>Loding</span>');
$.post("/e_com/scrolls/index?action=get&last_msg_id="+ID+"&productCategory="+productCategory,
function(data){
if (data != "") {
$(".message_box:last").after(data);
}
$('div#last_msg_loader').empty();
});
};
$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - $(window).height()){
last_msg_funtion();
}
});
});
</script>
|
|
|
|
|
Date :
2014-01-13 21:35:48 |
By :
kim_cmu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2014-01-14 18:54:39 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|