I´ve my call a ajax
$("#box-modal").on("shown",function(event)
{
$("button#add-cart").click(function()
{
if($("#selectproductname").val()!=='-1')
{
var valueidproduct = $("#inputidproducto").val();
var request = $.ajax({
type:'POST',
url: '/lineorder/addCart/'+valueidproduct,
data: $("#form-product").serialize(),
datatype:'html'
});
request.done(function(html) {
$( "#editor-panel > div" ).html( html);
});
request.fail(function( jqXHR, textStatus ) {
alert( "Request failed: " + textStatus );
});
}
When I call a my route php, and I want to get the result of a variable print two times why?. I only want one time.
$app->post('/lineorder/addCart/:id',function($id) use($app)
{
$str='';
//compruebo si el array de sesion del carrito era creado si no es creado procedemos a crearlo
if(!isset($_SESSION['cart-items']))
{
$_SESSION['cart-items'] = array();
}
$cantidad = $app->request()->post('inputcantidad');
$nombre = $app->request()->post('inputnombre');
var_dump($nombre);die();
In my
request.done(function(html)
{
$("#editor-panel > div").html(html);
}
print two times the result;
What´s the fix? What I do wrong?