So, I run this javascript . this code gets the html generated by cart.php
$.ajax({
type: "GET",
url: "/cart/cart.php",
async: false,
dataType: "html",
success: function(html){
$('#cart_content').html(html);
}
QUESTION ! how can get the value of a variable in cart.php ?
I would love something like this : $('#cart_content').html($myvar);
Personally, the easiest way is to return json, or simply echo-ing out the data you want returned. If you were to do json, change the dataType to json, and then, on cart.php,
echo json_encode(array('varname'=>$myvar));In your success function, you will be able to call that variable:
$('#cart_content').html(html.varname);If you choose to go the simple route, on cart.php, just echo the data. Your success function will have it stored as html.