Javascript 带模板器的Ajax刷新块
我需要刷新后的ajax提交页面。 试试这个,但不成功Javascript 带模板器的Ajax刷新块,javascript,php,jquery,ajax,Javascript,Php,Jquery,Ajax,我需要刷新后的ajax提交页面。 试试这个,但不成功 function show() { $.ajax({ url: "engine/modules/eshop_cart.php", cache: false, success: function(html){ $("#result").html(html);
function show()
{
$.ajax({
url: "engine/modules/eshop_cart.php",
cache: false,
success: function(html){
$("#result").html(html);
}
});
}
function addCart(){
var price = $("#price_id").text();
var name = $("#name_id").text();
$.post(
"engine/ajax/eshop_cart.php",
{
price: price,
name: name
},
onAjaxSuccess
);
}
function onAjaxSuccess(data)
{
show();
}
文件引擎/模块/eshop_购物车:
$myip = $_SERVER["REMOTE_ADDR"];
$select = $db->query("SELECT * FROM ".PREFIX."_shop_cart WHERE ip='$myip'");
while($row = $db->get_row($select)){
$tpl->load_template("eshop/cartitems.tpl");
$tpl->set("{r_name}", $row["name"]);
$tpl->set("{r_price}", $row["price"]);
$tpl->set("{r_count}", $row["count"]);
$tpl->compile("cartlist");
$tpl->clear();
}
$tpl->load_template("eshop/cart.tpl");
$tpl->set("{old_cart}", $tpl->result["cartlist"]);
$tpl->compile("cart");
$tpl->clear();
如果im使用我的代码,则id=result的POST submit块后为空。
就波林语而言。。帮助我,为我的英语不好感到抱歉试试这个
function show()
{
$.ajax({
url: "engine/modules/eshop_cart.php",
cache: false,
success: function(html){
$("#result").html(html);
location.reload();
}
});
}